Class PusherOptions

    • Field Detail

      • LIB_VERSION

        public static final java.lang.String LIB_VERSION
    • Method Detail

      • isEncrypted

        @Deprecated
        public boolean isEncrypted()
        Deprecated.
        Please use isUseTLS
      • isUseTLS

        public boolean isUseTLS()
        Returns:
        whether the connection to Pusher should use TLS
      • setUseTLS

        public PusherOptions setUseTLS​(boolean useTLS)
        Sets whether the connection to Pusher should be use TLS.
        Parameters:
        useTLS - whether the connection should use TLS, by default this is true
        Returns:
        this, for chaining
      • setUserAuthenticator

        public PusherOptions setUserAuthenticator​(UserAuthenticator userAuthenticator)
        Sets the user authenticator to be used when signing in.
        Parameters:
        userAuthenticator - The user authenticator to be used.
        Returns:
        this, for chaining
      • getChannelAuthorizer

        public ChannelAuthorizer getChannelAuthorizer()
        Gets the channel authorizer to be used when authorizing private and presence channels.
        Returns:
        the channel authorizer
      • setChannelAuthorizer

        public PusherOptions setChannelAuthorizer​(ChannelAuthorizer channelAuthorizer)
        Sets the channel authorizer to be used when authorizing private and presence channels.
        Parameters:
        channelAuthorizer - The channel authorizer to be used.
        Returns:
        this, for chaining
      • setHost

        public PusherOptions setHost​(java.lang.String host)
        The host to which connections will be made.

        Note that if you wish to connect to a standard Pusher cluster, the convenience method setCluster will set the host and ports correctly from a single argument.

        Parameters:
        host - The host
        Returns:
        this, for chaining
      • setWsPort

        public PusherOptions setWsPort​(int wsPort)
        The port to which non TLS connections will be made.

        Note that if you wish to connect to a standard Pusher cluster, the convenience method setCluster will set the host and ports correctly from a single argument.

        Parameters:
        wsPort - port number
        Returns:
        this, for chaining
      • setWssPort

        public PusherOptions setWssPort​(int wssPort)
        The port to which encrypted connections will be made.

        Note that if you wish to connect to a standard Pusher cluster, the convenience method setCluster will set the host and ports correctly from a single argument.

        Parameters:
        wssPort - port number
        Returns:
        this, for chaining
      • setActivityTimeout

        public PusherOptions setActivityTimeout​(long activityTimeout)
        The number of milliseconds of inactivity at which a "ping" will be triggered to check the connection.

        The default value is 120,000 (2 minutes). On some connections, where intermediate hops between the application and Pusher are aggressively culling connections they consider to be idle, a lower value may help preserve the connection.

        Parameters:
        activityTimeout - time to consider connection idle, in milliseconds
        Returns:
        this, for chaining
      • setPongTimeout

        public PusherOptions setPongTimeout​(long pongTimeout)
        The number of milliseconds after a "ping" is sent that the client will wait to receive a "pong" response from the server before considering the connection broken and triggering a transition to the disconnected state.

        The default value is 30,000.

        Parameters:
        pongTimeout - time to wait for pong response, in milliseconds
        Returns:
        this, for chaining
      • setMaxReconnectGapInSeconds

        public PusherOptions setMaxReconnectGapInSeconds​(int maxReconnectGapInSeconds)
        The delay in two reconnection extends exponentially (1, 2, 4, .. seconds) This property sets the maximum in between two reconnection attempts.
        Parameters:
        maxReconnectGapInSeconds - time in seconds of the maximum gab between two reconnection attempts, default = MAX_RECONNECT_GAP_IN_SECONDS 30s
        Returns:
        this, for chaining
      • buildUrl

        public java.lang.String buildUrl​(java.lang.String apiKey)
        Construct the URL for the WebSocket connection based on the options previous set on this object and the provided API key
        Parameters:
        apiKey - The API key
        Returns:
        the WebSocket URL
      • setProxy

        public PusherOptions setProxy​(java.net.Proxy proxy)
        The default value is Proxy.NO_PROXY.
        Parameters:
        proxy - Specify a proxy, e.g. options.setProxy( new Proxy( Proxy.Type.HTTP, new InetSocketAddress( "proxyaddress", 80 ) ) );
        Returns:
        this, for chaining
      • getProxy

        public java.net.Proxy getProxy()
        Returns:
        The proxy to be used when opening a websocket connection to Pusher.