Class: MessageHandler

Session.messages. MessageHandler

new MessageHandler()

The handler interface for receiving messages sent from sessions to the server. This interface must be implemented by the user, to be registered via Session.messages#addHandler.

A message handler has a lifecycle that reflects the registration state on the server. This is expressed through the callback methods. Once onClose has been closed, no further interactions will occur.

Messages received by a handler contain the identity of the original sender.

  • since 6.2

    One-way messaging is deprecated in favor of request-response messaging. See sendRequest and sendRequestToFilter. This interface will be removed in a future release.



Called when the handler has been registered at the server and is now active.

Name Type Description
unregister function

A function to call that will unregister and close this handler


Called when the handler is unregistered, or the session is closed.


Handle a message that was sent by another session to the server, on a path that is a descendant of the path which this handler is registered for.

Name Type Description
message Session.messages.SessionMessage

The received message