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?, error?) => void)> = ...

Type declaration

    • (data?, error?): void
    • Parameters

      Returns void

clock_drift: number = 0.0
current_ping_interval: number
last_request_id: number = 0
latency: number = 0.0
manually_disconnected: boolean = false
ping_timer?: Timeout
promises_in_flight: Map<number, {
    args: any[];
    command: string;
    reject: ((...args) => void);
    resolve: ((...args) => void);
}> = ...

Type declaration

  • args: any[]
  • command: string
  • reject: ((...args) => void)
      • (...args): void
      • Parameters

        • Rest ...args: any[]

        Returns void

  • resolve: ((...args) => void)
      • (...args): void
      • Parameters

        • Rest ...args: any[]

        Returns void

reconnect_tries: number = 0
reconnecting: boolean = false
send_queue: (() => void)[] = []

Type declaration

    • (): void
    • Returns void

socket: WebSocket
timeout_timer?: Timeout
url: string

Accessors

Methods