Class HttpClientConnection

Represents an HTTP connection from a client to a server

Hierarchy

Constructors

Methods

Events

Constructors

  • Asynchronously establish a new HttpClientConnection.

    Parameters

    • bootstrap: undefined | ClientBootstrap

      Client bootstrap to use when initiating socket connection. Leave undefined to use the default system-wide bootstrap (recommended).

    • host_name: string

      Host to connect to

    • port: number

      Port to connect to on host

    • socket_options: SocketOptions

      Socket options

    • Optional tls_opts: TlsConnectionOptions

      Optional TLS connection options

    • Optional proxy_options: HttpProxyOptions

      Optional proxy options

    • Optional handle: any

    Returns HttpClientConnection

Methods

  • Create HttpClientStream to carry out the request/response exchange.

    NOTE: The stream sends no data until :meth:HttpClientStream.activate() is called. Call activate when you're ready for callbacks and events to fire.

    Parameters

    • request: HttpRequest

      The HttpRequest to attempt on this connection

    Returns HttpClientStream

    A new stream that will deliver events for the request

  • Close the connection. Shutdown is asynchronous. This call has no effect if the connection is already closing.

    Returns void

  • Forces all written events to be buffered in memory. The buffered data will be flushed when uncork is called.

    Returns void

  • Flushes all data buffered since cork was called.

    NOTE: It is HIGHLY recommended that uncorking should always be done via process.nextTick, not during the EventEmitter.on() call.

    Returns void

  • Synchronously calls each of the listeners registered for the event key supplied in registration order. If the BufferedEventEmitter is currently corked, the event will be buffered until uncork is called.

    Parameters

    • event: EventKey

      The name of the event

    • Rest ...args: any[]

      Event payload

    Returns boolean

Events

CONNECT: string = 'connect'

Emitted when the connection is connected and ready to start streams

ERROR: string = 'error'

Emitted when an error occurs on the connection

CLOSE: string = 'close'

Emitted when the connection has completed

Generated using TypeDoc