Listener - http : Listener

This is used for creating HTTP server endpoints. An HTTP server endpoint is capable of responding to remote callers. The Listener is responsible for initializing the endpoint using the provided configurations.

Constructor

__init

(int port, ListenerConfiguration? config)

  • port int
  • Listening port of the HTTP service listener

Methods

Stops the service listener gracefully.
Stops the service listener immediately.
Detaches a Http or WebSocket service from the listener.
Gets invoked during module initialization to initialize the endpoint.

LifeCycle Methods

Starts the registered service programmatically.
Attaches a service to the listener.

Methods

__gracefulStop

()

returns error?

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

()

returns error?

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

(service s)

returns error?

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 ()

init

Gets invoked during module initialization to initialize the endpoint.

Parameters

initEndpoint

()

returns error?

  • Return Type

    (error?)

LifeCycle Methods

__start

()

returns error?

Starts the registered service programmatically.

  • Return Type

    (error?)
  • An error if an error occurred during the listener starting process

__attach

(service s, string? name)

returns error?

Attaches a service to the listener.

Parameters

  • s service
  • The service that needs to be attached

  • name string? (default ())
  • Name of the service

  • Return Type

    (error?)
  • An error an error occurred during the service attachment process or else nil