PathIdsListener
The PathIdsListener type describes a function that is used to listen to changes of active paths that a WsServer is handling.
(
wsServer: WsServer,
pathId: Id,
addedOrRemoved: IdAddedOrRemoved,
): void| Type | Description | |
|---|---|---|
wsServer | WsServer | A reference to the |
pathId | Id | The |
addedOrRemoved | IdAddedOrRemoved | Whether the path was added ( |
| returns | void | This has no return value. |
A WsServer listens to any path, allowing an app to have the concept of distinct 'rooms' that only certain clients are participating in. As soon as a single client connects to a new path, this listener will be called with the Id of the new path and an addedOrRemoved value of 1.
When the final client disconnects from a path, it will be called again with the Id of the deactivated path and an addedOrRemoved value of -1.
A PathIdsListener is provided when using the addPathIdsListener method. See that method for specific examples.
Since
v5.0.3