Listener: Listener

Represents a Subscriber Service listener endpoint.

Constructor

Invoked during the initialization of a websub:Listener. Either an http:Listener or a port number must be provided to initialize the listener.

init (int | Listener listenTo, *ListenerConfiguration config)
  • listenTo int | Listener
  • An http:Listener or a port number to listen for the service

LifeCycle Methods

attach

Attaches the provided Service to the Listener.

Methods

attachWithConfig

Setup the provided Service with given configurations and attaches it to the listener

detach

Detaches the provided Service from the Listener.

'start

Starts the attached Service.

gracefulStop

Gracefully stops the hub listener.

immediateStop

Stops the service listener immediately.

attach

function attach(SubscriberService subscriberService, string[ ] | string? name) returns error?
Isolated Function

Attaches the provided Service to the Listener.

Parameters

  • name string[ ] | string? (default ())
  • The path of the Service to be hosted

Return Type

(error?)

An error, if an error occurred during the service attaching process

attachWithConfig

function attachWithConfig(SubscriberService subscriberService, SubscriberServiceConfiguration configuration, string[ ] | string? name) returns error?
Isolated Function

Setup the provided Service with given configurations and attaches it to the listener

Parameters

  • name string[ ] | string? (default ())
  • The path of the Service to be hosted

Return Type

(error?)

An error, if an error occurred during the service attaching process

detach

function detach(SubscriberService s) returns error?
Isolated Function

Detaches the provided Service from the Listener.

Parameters

Return Type

(error?)

An error, if an error occurred during the service detaching process

'start

function 'start() returns error?
Isolated Function

Starts the attached Service.

Return Type

(error?)

An error, if an error occurred during the listener starting process

gracefulStop

function gracefulStop() returns error?
Isolated Function

Gracefully stops the hub listener. Already accepted requests will be served before the 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 stopping process