Interface ClientToAIServer

This is an exhaustive list of the messages that the client can send to the AI servers.

interface ClientToAIServer {
    ai-analyze-position: ((data) => any);
    ai-analyze-subscribe: ((data) => void);
    ai-analyze-unsubscribe: ((data) => void);
    ai-analyze-variation: ((data) => void);
    ai-relay-analyzed-position: ((data) => any);
    ai-review-connect: ((data) => void);
    ai-review-disconnect: ((data) => void);
    authenticate: ((data) => undefined | {
        id: number;
        username: string;
    });
    net/ping: ((data) => void);
}

Hierarchy (view full)

Properties

ai-analyze-position: ((data) => any)

Requests a position be analyzed, intermediate and final results are sent to the given channel. The final response is returned as well.

Type declaration

    • (data): any
    • Parameters

      • data: {
            black_prisoners: number;
            board: number[][];
            channel_id: string;
            komi: number;
            player: JGOFNumericPlayerColor;
            rules: RuleSet;
            uuid: string;
            white_prisoners: number;
        }
        • black_prisoners: number

          Number of captures black has

        • board: number[][]

          Board position state

        • channel_id: string

          Channel identifier, for instance ai-position-analysis-stream-review-

        • komi: number

          Komi

        • player: JGOFNumericPlayerColor

          Whose turn it is

        • rules: RuleSet

          Ruleset to use

        • uuid: string

          UUID identifying the request

        • white_prisoners: number

          Number of captures white has

      Returns any

ai-analyze-subscribe: ((data) => void)

Subscribers to analyze position calls

Type declaration

    • (data): void
    • Parameters

      • data: {
            channel_id: string;
        }
        • channel_id: string

      Returns void

ai-analyze-unsubscribe: ((data) => void)

Un-subscribers to analyze position calls

Type declaration

    • (data): void
    • Parameters

      • data: {
            channel_id: string;
        }
        • channel_id: string

      Returns void

ai-analyze-variation: ((data) => void)

Type declaration

    • (data): void
    • Parameters

      • data: {
            ai_review_id: string | number;
            from: number;
            game_id: string | number;
            uuid: string;
            variation: string;
        }
        • ai_review_id: string | number

          The AI review id we're basing our analysis off of

        • from: number

          The move number we're branching from

        • game_id: string | number

          The game id we're analyzing

        • uuid: string

          AI UUID

        • variation: string

          Move string

      Returns void

ai-relay-analyzed-position: ((data) => any)

Relay an already analyzed position out to any other viewers

Type declaration

    • (data): any
    • Parameters

      • data: {
            channel_id: string;
            data: any;
        }
        • channel_id: string

          Channel identifier, for instance ai-position-analysis-stream-review-

        • data: any

      Returns any

ai-review-connect: ((data) => void)

Type declaration

    • (data): void
    • Parameters

      • data: {
            ai_review_id: string | number;
            game_id: string | number;
            uuid: string;
        }
        • ai_review_id: string | number

          The AI review id we're basing our analysis off of

        • game_id: string | number

          The game id we're reviewing

        • uuid: string

          AI UUID

      Returns void

ai-review-disconnect: ((data) => void)

Type declaration

    • (data): void
    • Parameters

      • data: {
            uuid: string;
        }
        • uuid: string

          AI UUID

      Returns void

authenticate: ((data) => undefined | {
    id: number;
    username: string;
})

Authenticate with the server.

Prior to authentication, you should perform a GET request to /api/v1/ui/config to get the current configuration. Within the returned JSON you will find all of the necessary fields to authenticate.

Type declaration

    • (data): undefined | {
          id: number;
          username: string;
      }
    • Parameters

      • data: {
            bot_apikey?: string;
            bot_username?: string;
            client?: string;
            client_version?: string;
            device_id?: string;
            jwt: string;
            language?: string;
            language_version?: string;
            user_agent?: string;
        }
        • Optional bot_apikey?: string

          Bot API key, if applicable

        • Optional bot_username?: string

          Bot username connecting, if applicable

        • Optional client?: string

          Client name (your application name)

        • Optional client_version?: string

          Client version string.

        • Optional device_id?: string

          Client generated unique id for the device.

        • jwt: string

          The JSON Web Token (user_jwt field) from /api/v1/ui/config. If connecting as a guest, send ""

        • Optional language?: string

          ISO 639-1 language code used on this device.

        • Optional language_version?: string

          The version of the translation dictionary.

        • Optional user_agent?: string

          Browser user agent (or websocket library)

      Returns undefined | {
          id: number;
          username: string;
      }

net/ping: ((data) => void)

Sends a ping to the server. This message should be sent regularly. The default interval is 10 seconds. This keeps the connection alive and allows a client to measure clock drift and latency, both of which are vital to adjusting the client's game clock displays.

Type declaration

    • (data): void
    • Parameters

      • data: {
            client: number;
            drift: number;
            latency: number;
        }
        • client: number

          Client timestamp - milliseconds since epoch

        • drift: number

          Last clock drift measurement, or 0

        • latency: number

          Last latency measurement, or 0

      Returns void