Interface ISocketReturn<T>

interface ISocketReturn<T> {
    close: {
        (code?, reason?): void;
        (code?, reason?): void;
    };
    data?: Ref<null | T>;
    send: ((data, useBuffer?) => boolean);
    websocketOpen: (() => void);
    ws: Ref<undefined | WebSocket>;
}

Type Parameters

  • T

Properties

close: {
    (code?, reason?): void;
    (code?, reason?): void;
}

Type declaration

    • (code?, reason?): void
    • Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.

      Parameters

      • Optional code: number
      • Optional reason: string

      Returns void

    • (code?, reason?): void
    • Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.

      Parameters

      • Optional code: number
      • Optional reason: string

      Returns void

data?: Ref<null | T>
send: ((data, useBuffer?) => boolean)

Type declaration

    • (data, useBuffer?): boolean
    • Parameters

      • data: string | ArrayBuffer | Blob
      • Optional useBuffer: boolean

      Returns boolean

websocketOpen: (() => void)

Type declaration

    • (): void
    • Returns void

ws: Ref<undefined | WebSocket>