bothy-sdk
    Preparing search index...

    Interface GatewaySocket

    The part of a WebSocket the gateway uses: the WHATWG interface of the global WebSocket of Node.js, which the ws package offers too.

    interface GatewaySocket {
        readyState: number;
        addEventListener(type: string, listener: (event: unknown) => void): void;
        close(code?: number, reason?: string): void;
        send(data: string): void;
    }
    Index

    Properties

    readyState: number

    0 connecting, 1 open, 2 closing, 3 closed.

    Methods

    • Registers a listener for open, message, close or error.

      Parameters

      • type: string

        The event type.

      • listener: (event: unknown) => void

        Receives the event (data of a message, code and reason of a close).

      Returns void

    • Starts the closing handshake.

      Parameters

      • Optionalcode: number

        1000 or a code from 3000 to 4999 (the WHATWG rule).

      • Optionalreason: string

        The reason text.

      Returns void

    • Sends a text frame.

      Parameters

      • data: string

        The frame.

      Returns void