Documentation
    Preparing search index...

    Class WS

    WS

    Hierarchy

    • TypedEventTarget
      • WS
    Index
    onclose: ((this: WS, ev: CloseEvent) => any) | undefined = undefined
    onerror: ((this: WS, ev: Event) => any) | undefined = undefined
    onmessage: ((this: WS, ev: MessageEvent) => any) | undefined = undefined
    onopen: ((this: WS, ev: Event) => any) | undefined = undefined
    options: Required<WSOptions>
    • get bufferedAmount(): number

      Returns the number of bytes of application data (UTF-8 text and binary data) that have been queued using send() but not yet been transmitted to the network.

      If the WebSocket connection is closed, this attribute's value will only increase with each call to the send() method. (The number does not reset to zero once the connection closes.)

      MDN Reference

      Returns number

    • get protocol(): string

      Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation.

      MDN Reference

      Returns string

    • Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.

      MDN Reference

      Parameters

      • Optionalcode: number = 1000
      • Optionalreason: string

      Returns void