Interface WebSocket

The WebSocket class represents websocket connections in the page.

Hierarchy

  • WebSocket

Methods

  • Fired when the websocket closes.

    Parameters

    • event: "close"
    • listener: ((webSocket) => any)
        • (webSocket): any
        • Parameters

          Returns any

    Returns WebSocket

  • Fired when the websocket receives a frame.

    Parameters

    • event: "framereceived"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Fired when the websocket sends a frame.

    Parameters

    • event: "framesent"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Fired when the websocket has an error.

    Parameters

    • event: "socketerror"
    • listener: ((string) => any)
        • (string): any
        • Parameters

          • string: string

          Returns any

    Returns WebSocket

  • Indicates that the web socket has been closed.

    Returns boolean

  • Removes an event listener added by on or addListener.

    Parameters

    • event: "close"
    • listener: ((webSocket) => any)
        • (webSocket): any
        • Parameters

          Returns any

    Returns WebSocket

  • Removes an event listener added by on or addListener.

    Parameters

    • event: "framereceived"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Removes an event listener added by on or addListener.

    Parameters

    • event: "framesent"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Removes an event listener added by on or addListener.

    Parameters

    • event: "socketerror"
    • listener: ((string) => any)
        • (string): any
        • Parameters

          • string: string

          Returns any

    Returns WebSocket

  • Fired when the websocket closes.

    Parameters

    • event: "close"
    • listener: ((webSocket) => any)
        • (webSocket): any
        • Parameters

          Returns any

    Returns WebSocket

  • Fired when the websocket receives a frame.

    Parameters

    • event: "framereceived"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Fired when the websocket sends a frame.

    Parameters

    • event: "framesent"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Fired when the websocket has an error.

    Parameters

    • event: "socketerror"
    • listener: ((string) => any)
        • (string): any
        • Parameters

          • string: string

          Returns any

    Returns WebSocket

  • Adds an event listener that will be automatically removed after it is triggered once. See addListener for more information about this event.

    Parameters

    • event: "close"
    • listener: ((webSocket) => any)
        • (webSocket): any
        • Parameters

          Returns any

    Returns WebSocket

  • Adds an event listener that will be automatically removed after it is triggered once. See addListener for more information about this event.

    Parameters

    • event: "framereceived"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Adds an event listener that will be automatically removed after it is triggered once. See addListener for more information about this event.

    Parameters

    • event: "framesent"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Adds an event listener that will be automatically removed after it is triggered once. See addListener for more information about this event.

    Parameters

    • event: "socketerror"
    • listener: ((string) => any)
        • (string): any
        • Parameters

          • string: string

          Returns any

    Returns WebSocket

  • Fired when the websocket closes.

    Parameters

    • event: "close"
    • listener: ((webSocket) => any)
        • (webSocket): any
        • Parameters

          Returns any

    Returns WebSocket

  • Fired when the websocket receives a frame.

    Parameters

    • event: "framereceived"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Fired when the websocket sends a frame.

    Parameters

    • event: "framesent"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Fired when the websocket has an error.

    Parameters

    • event: "socketerror"
    • listener: ((string) => any)
        • (string): any
        • Parameters

          • string: string

          Returns any

    Returns WebSocket

  • Removes an event listener added by on or addListener.

    Parameters

    • event: "close"
    • listener: ((webSocket) => any)
        • (webSocket): any
        • Parameters

          Returns any

    Returns WebSocket

  • Removes an event listener added by on or addListener.

    Parameters

    • event: "framereceived"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Removes an event listener added by on or addListener.

    Parameters

    • event: "framesent"
    • listener: ((data) => any)
        • (data): any
        • Parameters

          • data: {
                payload: string | Buffer;
            }
            • payload: string | Buffer

              frame payload

          Returns any

    Returns WebSocket

  • Removes an event listener added by on or addListener.

    Parameters

    • event: "socketerror"
    • listener: ((string) => any)
        • (string): any
        • Parameters

          • string: string

          Returns any

    Returns WebSocket

  • Contains the URL of the WebSocket.

    Returns string

  • Fired when the websocket closes.

    Parameters

    • event: "close"
    • Optional optionsOrPredicate: {
          predicate?: ((webSocket) => boolean | Promise<boolean>);
          timeout?: number;
      } | ((webSocket) => boolean | Promise<boolean>)
      Optional

    Returns Promise<WebSocket>

  • Fired when the websocket receives a frame.

    Parameters

    • event: "framereceived"
    • Optional optionsOrPredicate: {
          predicate?: ((data) => boolean | Promise<boolean>);
          timeout?: number;
      } | ((data) => boolean | Promise<boolean>)
      Optional

    Returns Promise<{
        payload: string | Buffer;
    }>

  • Fired when the websocket sends a frame.

    Parameters

    • event: "framesent"
    • Optional optionsOrPredicate: {
          predicate?: ((data) => boolean | Promise<boolean>);
          timeout?: number;
      } | ((data) => boolean | Promise<boolean>)
      Optional

    Returns Promise<{
        payload: string | Buffer;
    }>

  • Fired when the websocket has an error.

    Parameters

    • event: "socketerror"
    • Optional optionsOrPredicate: {
          predicate?: ((string) => boolean | Promise<boolean>);
          timeout?: number;
      } | ((string) => boolean | Promise<boolean>)
      Optional

    Returns Promise<string>

Generated using TypeDoc