Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Properties

CLOSED: 3

The connection is closed.

CLOSING: 2

The connection is in the process of closing.

CONNECTING: 0

The connection is not yet open.

OPEN: 1

The connection is open and ready to communicate.

binaryType: "nodebuffer" | "arraybuffer" | "fragments"
bufferedAmount: number
extensions: string
isPaused: boolean

Indicates whether the websocket is paused

protocol: string
readyState: 0 | 1 | 2 | 3

The current state of the connection

url: string

Methods

  • close(code?: number, data?: string | Buffer): void
  • Parameters

    • Optional code: number
    • Optional data: string | Buffer

    Returns void

  • pause(): void
  • Pause the websocket causing it to stop emitting events. Some events can still be emitted after this is called, until all buffered data is consumed. This method is a noop if the ready state is CONNECTING or CLOSED.

    Returns void

  • ping(data?: any, mask?: boolean, cb?: (err: Error) => void): void
  • Parameters

    • Optional data: any
    • Optional mask: boolean
    • Optional cb: (err: Error) => void
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns void

  • pong(data?: any, mask?: boolean, cb?: (err: Error) => void): void
  • Parameters

    • Optional data: any
    • Optional mask: boolean
    • Optional cb: (err: Error) => void
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns void

  • resume(): void
  • Make a paused socket resume emitting events. This method is a noop if the ready state is CONNECTING or CLOSED.

    Returns void

  • send(data: any, cb?: (err?: Error) => void): void
  • send(data: any, options: { binary?: boolean; compress?: boolean; fin?: boolean; mask?: boolean }, cb?: (err?: Error) => void): void
  • Parameters

    • data: any
    • Optional cb: (err?: Error) => void
        • (err?: Error): void
        • Parameters

          • Optional err: Error

          Returns void

    Returns void

  • Parameters

    • data: any
    • options: { binary?: boolean; compress?: boolean; fin?: boolean; mask?: boolean }
      • Optional binary?: boolean
      • Optional compress?: boolean
      • Optional fin?: boolean
      • Optional mask?: boolean
    • Optional cb: (err?: Error) => void
        • (err?: Error): void
        • Parameters

          • Optional err: Error

          Returns void

    Returns void

  • terminate(): void
  • Returns void