HTTP Server Connection
The HTTP Server Connection instance represents an active connection to an HTTP server.
Instance Properties
Section titled “Instance Properties”The route object for this connection.
routeInstance Methods
Section titled “Instance Methods”accept(options)
Section titled “accept(options)”Accepts a new stream and returns a connection instance.
accept(options)Parameters
Section titled “Parameters”options
socket- ATCP Server Connectioninstance.
TLSSocket(optional) - A TLS socket instance for HTTPS connections.
close()
Section titled “close()”Closes the connection.
close()detach()
Section titled “detach()”Detaches the underlying TCP socket from the HTTP connection, returning control of the socket to the caller.
detach()Return Value
Section titled “Return Value”A TCP Server Connection instance.
get route()
Section titled “get route()”Gets the route configuration for this connection.
routeReturn Value
Section titled “Return Value”A route object.
set route(options)
Section titled “set route(options)”Sets the route configuration for this connection.
route = optionsParameters
Section titled “Parameters”options
path(optional) - A string representing the URL path.
method(optional) - A string representing the HTTP method.
handler(optional) - A callback function to handle the route.
respond(options)
Section titled “respond(options)”Sends an HTTP response.
respond(options)Parameters
Section titled “Parameters”options
status- The HTTP status code as a number.
headers(optional) - An object containing response headers.
body(optional) - The response body.