Class Options

java.lang.Object
io.github.centrifugal.centrifuge.Options

public class Options extends Object
Configuration for a Client instance.
  • Constructor Details

    • Options

      public Options()
  • Method Details

    • getToken

      public String getToken()
    • setToken

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

      public ConnectionTokenGetter getTokenGetter()
    • setTokenGetter

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

      public String getName()
    • setName

      public void setName(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 String getVersion()
    • setVersion

      public void setVersion(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(Map<String,String> headers)
      Set custom headers for WebSocket Upgrade request.
    • getHeaders

      public Map<String,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.
    • getOkHttpClient

      public okhttp3.OkHttpClient getOkHttpClient()
    • setOkHttpClient

      public void setOkHttpClient(okhttp3.OkHttpClient okHttpClient)
      Set OkHttpClient. Can be used to pass configured custom OkHttpClient (with DNS, proxy, SSLSocketFactory etc.).
    • setProxy

      public void setProxy(Proxy proxy)
      Set proxy to use in default OkHttpClient builder. Won't be used if setOkHttpClient(okhttp3.OkHttpClient) was used.
    • getProxy

      public Proxy getProxy()
    • setProxyCredentials

      public void setProxyCredentials(String login, String password)
      Set proxy credentials for default OkHttpClient builder. Won't be used if setOkHttpClient(okhttp3.OkHttpClient) was used.
    • getProxyLogin

      public String getProxyLogin()
    • getProxyPassword

      public String getProxyPassword()
    • getDns

      public Dns getDns()
    • setDns

      public void setDns(Dns dns)
      Set custom DNS resolver for default OkHttpClient builder. Won't be used if setOkHttpClient(okhttp3.OkHttpClient) was used.
    • setSSLSocketFactory

      public void setSSLSocketFactory(SSLSocketFactory sslSocketFactory)
      Set custom SSLSocketFactory for default OkHttpClient builder. Won't be used if setOkHttpClient(okhttp3.OkHttpClient) was used.
    • setSSLSocketFactory

      public void setSSLSocketFactory(SSLSocketFactory sslSocketFactory, X509TrustManager trustManager)
      Set custom SSLSocketFactory and X509TrustManager for default OkHttpClient builder. Won't be used if setOkHttpClient(okhttp3.OkHttpClient) was used.
    • getSSLSocketFactory

      public SSLSocketFactory getSSLSocketFactory()
    • getTrustManager

      public X509TrustManager getTrustManager()