Interface ServerSession

    • Method Detail

      • getServerTransport

        ServerTransport getServerTransport()
        Returns:
        the ServerTransport associated with this session
      • isLocalSession

        boolean isLocalSession()
        Returns:
        whether this is a session for a local client on server-side
      • getLocalSession

        LocalSession getLocalSession()
        Returns:
        the LocalSession associated with this session, or null if this is a session representing a remote client.
      • deliver

        void deliver​(Session sender,
                     java.lang.String channel,
                     java.lang.Object data,
                     Promise<java.lang.Boolean> promise)

        Delivers the given information to this session.

        Parameters:
        sender - the session delivering the message
        channel - the channel of the message
        data - the data of the message
        promise - the promise to notify with the result of the deliver
        See Also:
        deliver(Session, ServerMessage.Mutable, Promise)
      • getSubscriptions

        java.util.Set<ServerChannel> getSubscriptions()
        Returns:
        the set of channels to which this session is subscribed to
      • getUserAgent

        java.lang.String getUserAgent()
        Returns:
        The string indicating the client user agent, or null if not known
      • getInterval

        long getInterval()
        Returns:
        the period of time, in milliseconds, that the client associated with this session will wait before issuing a connect message, or -1 if the default value is used
        See Also:
        ServerTransport.getInterval(), setInterval(long)
      • setInterval

        void setInterval​(long interval)
        Parameters:
        interval - the period of time, in milliseconds, that the client associated with this session will wait before issuing a connect message
      • getTimeout

        long getTimeout()
        Returns:
        the period of time, in milliseconds, that the server will hold connect messages for this session or -1 if the default value is used
        See Also:
        ServerTransport.getTimeout()
      • setTimeout

        void setTimeout​(long timeout)
        Parameters:
        timeout - the period of time, in milliseconds, that the server will hold connect messages for this session
      • getMaxInterval

        long getMaxInterval()
        Returns:
        the max period of time, in milliseconds, that the server waits before expiring the session when the client does not send messages to the server, or -1 if the default value is used
      • setMaxInterval

        void setMaxInterval​(long maxInterval)
        Parameters:
        maxInterval - the max period of time, in milliseconds, that the server waits before expiring the session
      • isMetaConnectDeliveryOnly

        boolean isMetaConnectDeliveryOnly()
        Returns:
        whether delivery of messages only happens via the /meta/connect channel
      • setMetaConnectDeliveryOnly

        void setMetaConnectDeliveryOnly​(boolean metaConnectDeliveryOnly)

        Sets whether delivery of messages only happen via the /meta/connect channel.

        Transports that use more than one connection to the server (e.g. HTTP transports) may deliver some messages in one connection and some in another connection, causing messages to arrive out-of-order.

        Forcing messages to be delivered only via the /meta/connect channel guarantees server-to-client message ordering.

        Parameters:
        metaConnectDeliveryOnly - whether delivery of messages only happens via the /meta/connect channel
      • isBroadcastToPublisher

        boolean isBroadcastToPublisher()
        Returns:
        whether this session sends messages back to itself
      • setBroadcastToPublisher

        void setBroadcastToPublisher​(boolean broadcastToPublisher)
        Sets whether this session sends messages back to itself.
        Parameters:
        broadcastToPublisher - whether this session sends messages back to itself