Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpConnection

Represents an HTTP connection.

HTTP/1.x connection provides an limited implementation, the following methods are implemented:

  • {@link HttpConnection#close}
  • {@link HttpConnection#closeHandler}
  • {@link HttpConnection#exceptionHandler}

Hierarchy

  • HttpConnection

Index

Methods

close

  • Close the connection and all the currently active streams.

    An HTTP/2 connection will send a frame before.

    Returns PromiseLike<void>

  • Close the connection and all the currently active streams.

    An HTTP/2 connection will send a frame before.

    Parameters

    Returns void

closeHandler

  • Set a close handler. The handler will get notified when the connection is closed.

    Parameters

    • handler: ((res: void) => void) | Handler<void>

    Returns HttpConnection

exceptionHandler

  • Set an handler called when a connection error happens

    Parameters

    Returns HttpConnection

getWindowSize

  • getWindowSize(): number
  • Returns number

goAway

  • Like {@link HttpConnection#goAway} with a last stream id -1 which means to disallow any new stream creation.

    Parameters

    • errorCode: number

    Returns HttpConnection

  • Like {@link HttpConnection#goAway} with no buffer.

    Parameters

    • errorCode: number
    • lastStreamId: number

    Returns HttpConnection

  • Send a go away frame to the remote endpoint of the connection.

    • a frame is sent to the to the remote endpoint with the errorCode and debugData
    • any stream created after the stream identified by lastStreamId will be closed
    • for an is different than 0 when all the remaining streams are closed this connection will be closed automatically

    This is not implemented for HTTP/1.x.

    Parameters

    • errorCode: number
    • lastStreamId: number
    • debugData: Buffer

    Returns HttpConnection

goAwayHandler

  • Set an handler called when a frame is received.

    This is not implemented for HTTP/1.x.

    Parameters

    Returns HttpConnection

indicatedServerName

  • indicatedServerName(): string
  • Returns the SNI server name presented during the SSL handshake by the client.

    Returns string

isSsl

  • isSsl(): boolean
  • Returns boolean

localAddress

  • Returns SocketAddress

  • Like {@link HttpConnection#localAddress} ()} but returns the server local address when real is true

    Parameters

    • real: boolean

    Returns SocketAddress

ping

  • Send a frame to the remote endpoint.

    This is not implemented for HTTP/1.x.

    Parameters

    Returns PromiseLike<Buffer>

  • Send a frame to the remote endpoint.

    This is not implemented for HTTP/1.x.

    Parameters

    Returns HttpConnection

pingHandler

  • Set an handler notified when a frame is received from the remote endpoint.

    This is not implemented for HTTP/1.x.

    Parameters

    Returns HttpConnection

remoteAddress

  • Returns SocketAddress

  • Like {@link HttpConnection#remoteAddress} but returns the proxy remote address when real is true

    Parameters

    • real: boolean

    Returns SocketAddress

remoteSettings

  • Returns Http2Settings

remoteSettingsHandler

setWindowSize

  • Update the current connection wide window size to a new size.

    Increasing this value, gives better performance when several data streams are multiplexed

    This is not implemented for HTTP/1.x.

    Parameters

    • windowSize: number

    Returns HttpConnection

settings

  • Returns Http2Settings

shutdown

  • Initiate a graceful connection shutdown, the connection is taken out of service and closed when all current requests are processed, otherwise after 30 seconds the connection will be closed. Client connection are immediately removed from the pool.

    • HTTP/2 connections will send a go away frame immediately to signal the other side the connection will close
    • HTTP/1.x client connection supports this feature
    • HTTP/1.x server connections do not support this feature

    Returns PromiseLike<void>

  • Initiate a graceful connection shutdown, the connection is taken out of service and closed when all current requests are processed, otherwise after 30 seconds the connection will be closed. Client connection are immediately removed from the pool.

    • HTTP/2 connections will send a go away frame immediately to signal the other side the connection will close
    • HTTP/1.x client connection supports this feature
    • HTTP/1.x server connections do not support this feature

    Parameters

    Returns void

  • Like {@link HttpConnection#shutdown} but with a specific timeout in milliseconds.

    Parameters

    • timeout: number

    Returns PromiseLike<void>

  • Like {@link HttpConnection#shutdown} but with a specific timeout in milliseconds.

    Parameters

    Returns void

shutdownHandler

  • Set an handler called when a frame has been sent or received and all connections are closed.

    This is not implemented for HTTP/1.x.

    Parameters

    • handler: ((res: void) => void) | Handler<void> | null | undefined

    Returns HttpConnection

sslSession

  • sslSession(): any
  • Returns any

updateSettings

  • Send to the remote endpoint an update of this endpoint settings

    The completionHandler will be notified when the remote endpoint has acknowledged the settings.

    This is not implemented for HTTP/1.x.

    Parameters

    Returns PromiseLike<void>

  • Send to the remote endpoint an update of this endpoint settings

    The completionHandler will be notified when the remote endpoint has acknowledged the settings.

    This is not implemented for HTTP/1.x.

    Parameters

    Returns HttpConnection

Generated using TypeDoc