Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpStream

Represents a single http message exchange (request/response) in HTTP/1.1. In H2, it may also represent a PUSH_PROMISE followed by the accompanying response.

NOTE: Binding either the ready or response event will uncork any buffered events and start event delivery

Hierarchy

Implements

Index

Constructors

Protected constructor

Properties

Readonly connection

connection: HttpConnection

Static defaultMaxListeners

defaultMaxListeners: number

Methods

activate

  • activate(): void
  • Begin sending the request.

    The stream does nothing until this is called. Call activate() when you are ready for its callbacks and events to fire.

    Returns void

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

close

  • close(): void
  • Closes and ends all communication on this stream. Called automatically after the 'end' event is delivered. Calling this manually is only necessary if you wish to terminate communication mid-request/response.

    Returns void

cork

  • cork(): void

emit

  • emit(event: EventKey, ...args: any[]): boolean
  • 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 BufferedEventEmitter.uncork is called.

    Parameters

    • event: EventKey

      The name of the event

    • Rest ...args: any[]

      Event payload

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number

listenerCount

  • listenerCount(type: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this

uncork

  • uncork(): void
  • Flushes all data buffered since BufferedEventEmitter.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

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number

Generated using TypeDoc