Class: SessionPropertiesListener

Session.clients. SessionPropertiesListener


new SessionPropertiesListener()

The Session Properties Listener interface for receiving session property events. This interface must be implemented by the user, to be registered via Session.clients#setSessionPropertiesListener.


A session properties listener has a lifecycle that reflects the registration state on the server. This is expressed through the callback methods. Once onClose has been called, no further interactions will occur.

Methods


onActive(deregister)

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

Parameters:
Name Type Description
deregister function

A function to call that will deregister and close this handler.


onClose()

Called when the listener is deregistered, or the session is closed.


onError(error)

Notification of a contextual error related to this handler. This is analogous to an unchecked exception being raised. Situations in which onError is called include the session being closed before the handler is registered, a communication timeout, or a problem with the provided parameters. No further calls will be made to this handler.

Parameters:
Name Type Description
error Error

The error

Since:
  • 5.9

onSessionClose(session, properties, reason)

Notification that a client session has closed.


This will be called for every client that closes whilst the listener is registered, regardless of requested session properties.

Parameters:
Name Type Description
session Object

The session identifier

properties Object

The map of requested property values

reason Object

The reason why the session was closed


onSessionEvent(session, type, properties, previous)

Notification of a session event that can result in a change of properties.

Parameters:
Name Type Description
session Object

The session identifier

type Session.clients.SessionEventType

The type of event

properties Object

The map of requested property values

previous Object

A map of previous values for keys that have changed. This will only contain changed values and not the whole required property set.


onSessionOpen(session, properties)

Notification that a new client session has been opened.


When the listener is registered, this will be called for all existing sessions. It will then be called for every client session that opens whilst the listener is registered.

This will be called for client session regardless of requested session properties.

Parameters:
Name Type Description
session Object

The session identifier

properties Object

The map of requested session property values.