Listener: Listener

This is used for creating Websocket server endpoints. An 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 module initialization to initialize the listener.

init (int | Listener 'listener, *ListenerConfiguration config)

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 Http or WebSocket service from the listener.

initEndpoint

attach

function attach(Service s, string[ ] | string? name) returns error?
Isolated Function

Attaches a service to the listener.

Parameters

  • s Service
  • The service that needs to be attached

Return Type

(error?)

An error an error occurred during the service attachment process or else nil

'start

function 'start() returns error?
Isolated Function

Starts the registered service programmatically.

Return Type

(error?)

An error if an error occurred during the listener starting process

gracefulStop

function gracefulStop() returns error?
Isolated Function

Stops the service listener gracefully. Already-accepted requests will be served before connection closure.

Return Type

(error?)

An error if an error occurred during the listener stopping process

immediateStop

function immediateStop() returns error?
Isolated Function

Stops the service listener immediately. It is not implemented yet.

Return Type

(error?)

An error if an error occurred during the listener stop process

detach

function detach(Service s) returns error?
Isolated Function

Detaches a Http or WebSocket service from the listener. Note that detaching a WebSocket service would not affect The functionality of the existing connections.

Parameters

  • s Service
  • The service to be detached

Return Type

(error?)

An error if one occurred during detaching of a service or else ()

initEndpoint

function initEndpoint() returns Error?
Isolated Function

Return Type

(Error?)