Class Options


  • public class Options
    extends java.lang.Object
    Configuration for a Client instance.
    • Constructor Detail

      • Options

        public Options()
    • Method Detail

      • getToken

        public java.lang.String getToken()
      • setToken

        public void setToken​(java.lang.String token)
        Set connection token. If your tokens expire and you want SDK to automatically refresh tokens then set ConnectionTokenGetter (see below).
      • setTokenGetter

        public void setTokenGetter​(ConnectionTokenGetter tokenGetter)
        Set a method to extract new connection token upon expiration.
      • getName

        public java.lang.String getName()
      • setName

        public void setName​(java.lang.String name)
        Set client name - name of this client. This should not be unique per client – it identifies client application name actually, so name should have a limited number of possible values. By default this client uses "java" as a name.
      • getVersion

        public java.lang.String getVersion()
      • setVersion

        public void setVersion​(java.lang.String version)
        Set client version - version of application. This may be used for observability on the server (for example in analytics).
      • getData

        public byte[] getData()
      • setData

        public void setData​(byte[] data)
        Set custom connection data. This data will be delivered to server in Connect command. For Centrifugo this may be useful in case of using connect proxy.
      • setHeaders

        public void setHeaders​(java.util.Map<java.lang.String,​java.lang.String> headers)
        Set custom headers for WebSocket Upgrade request.
      • getHeaders

        public java.util.Map<java.lang.String,​java.lang.String> getHeaders()
      • getTimeout

        public int getTimeout()
      • setTimeout

        public void setTimeout​(int timeout)
        Set custom timeout for requests in milliseconds. By default, 5000 is used.
      • getMinReconnectDelay

        public int getMinReconnectDelay()
      • setMinReconnectDelay

        public void setMinReconnectDelay​(int minReconnectDelay)
        Set minimal time before reconnect attempt in milliseconds. By default, 500 is used.
      • getMaxReconnectDelay

        public int getMaxReconnectDelay()
      • setMaxReconnectDelay

        public void setMaxReconnectDelay​(int maxReconnectDelay)
        Set max time between reconnect attempts in milliseconds. By default, 20000 is used.
      • getMaxServerPingDelay

        public int getMaxServerPingDelay()
      • setMaxServerPingDelay

        public void setMaxServerPingDelay​(int maxServerPingDelay)
        Set max time of ping delay from server in milliseconds. By default, 10000 is used.
      • setProxy

        public void setProxy​(java.net.Proxy proxy)
        Set proxy to use.
      • getProxy

        public java.net.Proxy getProxy()
      • setProxyCredentials

        public void setProxyCredentials​(java.lang.String login,
                                        java.lang.String password)
        Set proxy credentials.
      • getProxyLogin

        public java.lang.String getProxyLogin()
      • getProxyPassword

        public java.lang.String getProxyPassword()
      • getDns

        public Dns getDns()
      • setDns

        public void setDns​(Dns dns)
        Set custom DNS resolver..