Listener: Listener
This is used for creating WebSocket server endpoints. A WebSocket server endpoint is capable of responding to
remote callers. The Listener
is responsible for initializing the endpoint using the provided configurations.
Constructor
Gets invoked during the module initialization to initialize the listener.
init (int | Listener 'listener, *ListenerConfiguration config)
- config *ListenerConfiguration
Configurations for the WebSocket service listener
LifeCycle Methods
attach | Attaches a service to the listener. |
Methods
'start | Starts the registered service programmatically. |
gracefulStop | Stops the service listener gracefully. |
immediateStop | Stops the service listener immediately. |
detach | Detaches a WebSocket service from the listener. |
attach
function attach(UpgradeService websocketService, string[ ] | string? name) returns error?
Attaches a service to the listener.
Parameters
- websocketService UpgradeService
The service that needs to be attached
detach
function detach(UpgradeService websocketService) returns error?
Detaches a WebSocket service from the listener. Note that detaching a WebSocket service would not affect The functionality of the existing connections.
Parameters
- websocketService UpgradeService
The service to be detached