Server in Aerys

The Server instance controls the whole listening and dispatches the parsed requests.

attach(ServerObserver)

Enables a ServerObserver instance to be notified of the updates.

detach(ServerObserver)

Disables notifications for the passed ServerObserver instance.

state()

Gets the current server state, which is one of the following class constants:

  • Server::STARTED
  • Server::STARTING
  • Server::STOPPING
  • Server::STOPPED

getOption(string)

Gets an option.

setOption(string, $value)

Sets an option.

stop(): Promise

Initiate shutdown sequence. The returned Promise will resolve when the server has successfully been stopped.