Interface ServerChannel

    • Method Detail

      • getSubscribers

        java.util.Set<ServerSession> getSubscribers()
        Returns:
        a snapshot of the set of subscribers of this channel
      • subscribe

        boolean subscribe​(ServerSession session)

        Subscribes the given session to this channel.

        Subscriptions are effective for broadcast channels and are successful no-operations for service channels.

        The subscription may fail if the session is already subscribed to the channel or if the session is expired or if the channel is a meta channel.

        Parameters:
        session - the session to subscribe
        Returns:
        whether the subscription succeeded
        See Also:
        unsubscribe(ServerSession)
      • unsubscribe

        boolean unsubscribe​(ServerSession session)

        Unsubscribes the given session from this channel.

        Unsubscriptions are effective for broadcast channels and are successful no-operations for service channels.

        The unsubscription may fail if the session is already unsubscribed from the channel or if the session is expired or if the channel is a meta channel.

        Parameters:
        session - the session to unsubscribe
        Returns:
        whether the unsubscription succeeded
      • publish

        void publish​(Session from,
                     ServerMessage.Mutable message,
                     Promise<java.lang.Boolean> promise)

        Publishes the given message to this channel, delivering the message to all the ServerSessions subscribed to this channel.

        Parameters:
        from - the session from which the message originates
        message - the message to publish
        promise - the promise to notify whether the message has been published
        See Also:
        publish(Session, Object, Promise)
      • publish

        void publish​(Session from,
                     java.lang.Object data,
                     Promise<java.lang.Boolean> promise)

        Publishes the given information to this channel.

        Parameters:
        from - the session from which the message originates
        data - the data of the message
        promise - the promise to notify whether the message has been published
        See Also:
        publish(Session, ServerMessage.Mutable, Promise)
      • remove

        void remove()

        Removes this channel, and all the children channels.

        If channel "/foo", "/foo/bar" and "/foo/blip" exist, removing channel "/foo" will remove also "/foo/bar" and "/foo/blip".

        The removal will notify BayeuxServer.ChannelListener listeners.