Interface ClientSession

    • Method Detail

      • handshake

        void handshake​(Map<String,​Object> template,
                       ClientSession.MessageListener callback)

        Initiates the bayeux protocol handshake with the server(s).

        The handshake initiated by this method is asynchronous and does not wait for the handshake response.

        template - additional fields to add to the handshake message.
        callback - the message listener to notify of the handshake result
      • disconnect

        default void disconnect()
        Description copied from interface: Session
        Disconnects this session, ending the link between the client and the server peers.
        Specified by:
        disconnect in interface Session
        See Also:
      • disconnect

        void disconnect​(ClientSession.MessageListener callback)

        Disconnects this session, ending the link between the client and the server peers.

        callback - the message listener to notify of the disconnect result
      • getChannel

        ClientSessionChannel getChannel​(String channelName)

        Returns a client side channel scoped by this session.

        The channel name may be for a specific channel (e.g. "/foo/bar") or for a wild channel (e.g. "/meta/**" or "/foo/*").

        This method will always return a channel, even if the the channel has not been created on the server side. The server side channel is only involved once a publish or subscribe method is called on the channel returned by this method.

        Typical usage examples are:

        channelName - specific or wild channel name.
        a channel scoped by this session.
      • remoteCall

        void remoteCall​(String target,
                        Object data,
                        ClientSession.MessageListener callback)

        Performs a remote call to the server, to the specified target, and with the given data as payload.

        The remote call response will be delivered via the callback parameter.

        Typical usage:

         clientSession.remoteCall("getOnlineStatus", userId, new MessageListener()
             public void onMessage(Message message)
                 if (message.isSuccessful())
                     String status = (String)message.getData();
                     // Update UI with online status.
                     // Remote call failed.
        target - the remote call target
        data - the remote call parameters
        callback - the listener that receives the remote call response