Interface ServerSession.MessageListener

All Superinterfaces:
Bayeux.BayeuxListener, EventListener, ServerSession.ServerSessionListener
Enclosing interface:
ServerSession

public static interface ServerSession.MessageListener extends ServerSession.ServerSessionListener

Listeners objects that implement this interface will be notified of message sending.

  • Method Details

    • onMessage

      default void onMessage(ServerSession session, ServerSession sender, ServerMessage message, Promise<Boolean> promise)

      Callback invoked when a message is sent.

      Implementers can decide to notify the promise with false to signal that the message should not be further processed, meaning that other session listeners will not be notified and that the message will be discarded for this session.

      Parameters:
      session - the session that will receive the message
      sender - the session that sent the message
      message - the message sent
      promise - the promise to notify whether the processing of the message should continue
    • onMessage

      default boolean onMessage(ServerSession session, ServerSession sender, ServerMessage message)
      Parameters:
      session - the session that will receive the message
      sender - the session that sent the message
      message - the message sent
      Returns:
      whether the processing of the message should continue