Class GobanSocket<SendProtocol, RecvProtocol>

This is a simple wrapper around the WebSocket API that provides a simple interface to connect to the Online-Go.com servers. It provides:

  • Reconnection
  • Deals with authentication
  • Event based API
  • Type safe sends and receives
  • Optional promise support for sends
  • Latency tracking (doubling as keep alive)

Type Parameters

Hierarchy

Constructors

Properties

authentication?: DataArgument<SendProtocol["authenticate"]>
callbacks: Map<number, ((data?: any, error?: ErrorResponse) => void)> = ...
clock_drift: number = 0.0
last_request_id: number = 0
latency: number = 0.0
manually_disconnected: boolean = false
options: GobanSocketOptions
ping_interval?: Timer
promises_in_flight: Map<number, {
    args: any[];
    command: string;
    reject: ((...args: any[]) => void);
    resolve: ((...args: any[]) => void);
}> = ...
reconnect_tries: number = 0
reconnecting: boolean = false
send_queue: (() => void)[] = []
socket: WebSocket
url: string

Accessors

Methods

  • Type Parameters

    • Command extends string | number | symbol

    Parameters

    • command: Command
    • data: DataArgument<SendProtocol[Command]>
    • Optional cb: ((data: ResponseType<SendProtocol[Command]>, error?: any) => void)
        • (data: ResponseType<SendProtocol[Command]>, error?: any): void
        • Parameters

          • data: ResponseType<SendProtocol[Command]>
          • Optional error: any

          Returns void

    Returns void

  • Type Parameters

    • Command extends string | number | symbol

    Parameters

    Returns Promise<ResponseType<SendProtocol[Command]>>

Generated using TypeDoc