Enumeration of events emitted by http.Server class in addition to its parent net.Server class.

Variables

@:value(cast "checkContinue")@:enum@:implinlineread onlyCheckContinue:ServerEvent<(request:IncomingMessage, response:ServerResponse) ‑> Void> = "checkContinue"

Emitted each time a request with an HTTP Expect: 100-continue is received. If this event is not listened for, the server will automatically respond with a 100 Continue as appropriate.

Handling this event involves calling response.writeContinue if the client should continue to send the request body, or generating an appropriate HTTP response (e.g. 400 Bad Request) if the client should not continue to send the request body.

When this event is emitted and handled, the 'request' event will not be emitted.

@:value(cast "checkExpectation")@:enum@:implinlineread onlyCheckExpectation:ServerEvent<(request:IncomingMessage, response:ServerResponse) ‑> Void> = "checkExpectation"

Emitted each time a request with an HTTP Expect header is received, where the value is not 100-continue. If this event is not listened for, the server will automatically respond with a 417 Expectation Failed as appropriate.

When this event is emitted and handled, the 'request' event will not be emitted.

@:value(cast "clientError")@:enum@:implinlineread onlyClientError:ServerEvent<(exception:Error, socket:Socket) ‑> Void> = "clientError"

If a client connection emits an 'error' event, it will be forwarded here. Listener of this event is responsible for closing/destroying the underlying socket. For example, one may wish to more gracefully close the socket with a custom HTTP response instead of abruptly severing the connection.

Default behavior is to try close the socket with a HTTP '400 Bad Request', or a HTTP '431 Request Header Fields Too Large' in the case of a HPE_HEADER_OVERFLOW error. If the socket is not writable it is immediately destroyed.

@:value(cast "close")@:enum@:implinlineread onlyClose:ServerEvent<() ‑> Void> = "close"

Emitted when the server closes.

@:value(cast "connect")@:enum@:implinlineread onlyConnect:ServerEvent<(request:IncomingMessage, socekt:Socket, head:Buffer) ‑> Void> = "connect"

Emitted each time a client requests an HTTP CONNECT method. If this event is not listened for, then clients requesting a CONNECT method will have their connections closed.

After this event is emitted, the request's socket will not have a 'data' event listener, meaning it will need to be bound in order to handle data sent to the server on that socket.

@:value(cast "connection")@:enum@:implinlineread onlyConnection:ServerEvent<Socket ‑> Void> = "connection"

This event is emitted when a new TCP stream is established. socket is typically an object of type net.Socket. Usually users will not want to access this event. In particular, the socket will not emit 'readable' events because of how the protocol parser attaches to the socket. The socket can also be accessed at request.connection.

This event can also be explicitly emitted by users to inject connections into the HTTP server. In that case, any Duplex stream can be passed.

If socket.setTimeout() is called here, the timeout will be replaced with server.keepAliveTimeout when the socket has served a request (if server.keepAliveTimeout is non-zero).

@:value(cast "request")@:enum@:implinlineread onlyRequest:ServerEvent<(request:IncomingMessage, response:ServerResponse) ‑> Void> = "request"

Emitted each time there is a request. There may be multiple requests per connection (in the case of HTTP Keep-Alive connections).

@:value(cast "upgrade")@:enum@:implinlineread onlyUpgrade:ServerEvent<(request:IncomingMessage, socket:Socket, buffer:Buffer) ‑> Void> = "upgrade"

Emitted each time a client requests an HTTP upgrade. Listening to this event is optional and clients cannot insist on a protocol change.

After this event is emitted, the request's socket will not have a 'data' event listener, meaning it will need to be bound in order to handle data sent to the server on that socket.