HTTP and WebSocket server class.

Hierarchy

  • Server

Constructors

Properties

_cluster: boolean
_listen: string[]
_quiet: boolean
_servers: (Server<typeof IncomingMessage, typeof ServerResponse> | Server<typeof IncomingMessage, typeof ServerResponse>)[] = []
_workers: number
app: App

Application this server handles.

headersTimeout: undefined | number

Limit the amount of time the parser will wait to receive the complete HTTP headers, defaults to 60000 (60 seconds).

keepAliveTimeout: undefined | number

Limit the amount of time of inactivity a server needs to wait for additional incoming data, after it has finished writing the last response, before a socket will be destroyed, defaults to 5000 (5 seconds).

maxRequestsPerSocket: undefined | number

Maximum number of requests socket can handle before closing keep alive connection, defaults to 0.

requestTimeout: undefined | number

Limit the amount of time for receiving the entire request from the client, defaults to 300000 (300 seconds).

reverseProxy: boolean

Reverse proxy mode.

urls: URL[] = []

Server URLs.

Methods

  • Parameters

    • location: string

    Returns Promise<void>

  • Parameters

    • req: IncomingMessage
    • raw: ServerResponse<IncomingMessage>

    Returns void

  • Parameters

    • wss: WebSocketServer
    • req: IncomingMessage
    • socket: Socket
    • head: Buffer

    Returns void

  • Parameters

    • req: IncomingMessage
    • socket: Socket
    • isWebSocket: boolean

    Returns ServerRequest

  • Start server.

    Returns Promise<void>

  • Stop server.

    Returns Promise<void>

  • Turn URL into listen arguments.

    Parameters

    • url: URL

    Returns ListenArgs

Generated using TypeDoc