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.

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)
  • error if occurred during detaching of a service or nil

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

Attach 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