Interface ServerToClient

interface ServerToClient {
    ERROR: ((data) => void);
    HUP: (() => void);
    active-bots: ((data) => void);
    active_game: ((data) => void);
    automatch/available/add: ((data) => void);
    automatch/available/remove: ((uuid) => void);
    automatch/cancel: ((data) => void);
    automatch/entry: ((data) => void);
    automatch/start: ((data) => void);
    chat-join: ((data) => void);
    chat-message: ((data) => void);
    chat-message-removed: ((data) => void);
    chat-part: ((data) => void);
    chat-topic: ((data) => void);
    chat-update-user: ((data) => void);
    game/:id/auto_resign: ((data) => void);
    game/:id/chat: ((data) => void);
    game/:id/chat/remove: ((data) => void);
    game/:id/clear_auto_resign: ((data) => void);
    game/:id/clock: ((data) => void);
    game/:id/conditional_moves: ((data) => void);
    game/:id/error: ((data) => void);
    game/:id/gamedata: ((data) => void);
    game/:id/latency: ((data) => void);
    game/:id/phase: ((data) => void);
    game/:id/removed_stones: ((data) => void);
    game/:id/removed_stones_accepted: ((data) => void);
    game/:id/reset-chats: (() => void);
    game/:id/stalling_score_estimate: ((data?) => void);
    game/:id/undo_accepted: ((data) => void);
    game/:id/undo_canceled: ((data) => void);
    game/:id/undo_requested: ((data) => void);
    gamelist-count: ((data) => void);
    gamelist-count-:channel: ((data) => void);
    hostinfo: ((data) => void);
    incident-report: ((data) => void);
    itc: ((data) => void);
    net/pong: ((data) => void);
    notification: ((data) => void);
    private-message: ((data) => void);
    private-superchat: ((data) => void);
    remote_storage/sync_complete: (() => void);
    remote_storage/update: ((data) => void);
    review/:id/full_state: ((data) => void);
    review/:id/r: ((data) => void);
    score-estimator-enabled-state: ((data) => void);
    seekgraph/global: ((messages) => void);
    ui-push: ((data) => void);
    user/jwt: ((jwt) => void);
    user/state: ((data) => void);
    user/update: ((user) => void);
    [k: `gamelist-count-${string}`]: ServerToClient["gamelist-count-:channel"];
}

Hierarchy (view full)

Indexable

[k: `gamelist-count-${string}`]: ServerToClient["gamelist-count-:channel"]

A move was made on a game

Properties

ERROR: ((data) => void)

An error occurred, the message string should be displayed to the user. For a list of errcode's used, see https://github.com/online-go/online-go.com/blob/devel/src/components/Errcode/Errcode.tsx

Type declaration

    • (data): void
    • Parameters

      • data: string | {
            errcode: string;
        }

      Returns void

HUP: (() => void)

The client should reload

Type declaration

    • (): void
    • Returns void

active-bots: ((data) => void)

Updates the list of bots that are connected and ready to the server

Type declaration

    • (data): void
    • Parameters

      • data: {
            [id: number]: User & {
                config: BotConfig;
            };
        }

      Returns void

active_game: ((data) => void)

Message to inform the client of an active game, or a change to an existing game

Type declaration

automatch/available/add: ((data) => void)

An automatch offer was added

Type declaration

    • (data): void
    • Parameters

      • data: {
            created: number;
            player: {
                id: number;
                username: string;
            };
            preferences: AutomatchPreferences;
            uuid: string;
        }
        • created: number
        • player: {
              id: number;
              username: string;
          }
          • id: number
          • username: string
        • preferences: AutomatchPreferences
        • uuid: string

      Returns void

automatch/available/remove: ((uuid) => void)

An automatch offer was removed

Type declaration

    • (uuid): void
    • Parameters

      • uuid: string

      Returns void

automatch/cancel: ((data) => void)

An automatch request was canceled

Type declaration

    • (data): void
    • Parameters

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

      Returns void

automatch/entry: ((data) => void)

An automatch request is active

Type declaration

automatch/start: ((data) => void)

An automatch request was started

Type declaration

    • (data): void
    • Parameters

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

      Returns void

chat-join: ((data) => void)

User(s) joined a chat channel

Type declaration

    • (data): void
    • Parameters

      • data: {
            channel: string;
            users: User[];
        }
        • channel: string

          The channel

        • users: User[]

          List of users that joined

      Returns void

chat-message: ((data) => void)

Chat message was received

Type declaration

    • (data): void
    • Parameters

      • data: {
            channel: string;
            country?: string;
            id: number;
            message: {
                i?: string;
                m: string;
                t: number;
            };
            professional: boolean;
            ranking: number;
            system?: true;
            system_message_type?: "flood";
            ui_class: string;
            username: string;
        }
        • channel: string

          The channel

        • Optional country?: string

          Country the user is from

        • id: number

          User id of the sender

        • message: {
              i?: string;
              m: string;
              t: number;
          }

          The message received

          • Optional i?: string

            Message id. This is always set for non system messages.

          • m: string

            Message text

          • t: number

            Timestamp of the message

        • professional: boolean

          True if the user is a professional

        • ranking: number

          Ranking of the sender

        • Optional system?: true

          Whether it's a system message or not

        • Optional system_message_type?: "flood"
        • ui_class: string

          UI class of the sender

        • username: string

          Username of the sender

      Returns void

chat-message-removed: ((data) => void)

A chat message should be removed from the display

Type declaration

    • (data): void
    • Parameters

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

          The channel

        • uuid: string

          Message id. Note, despite the name, I don't think this is always a uuid in uuid format, just treat it as a string.

      Returns void

chat-part: ((data) => void)

User left a chat channel

Type declaration

    • (data): void
    • Parameters

      • data: {
            channel: string;
            user: User;
        }
        • channel: string

          The channel

        • user: User

          User that left

      Returns void

chat-topic: ((data) => void)

Channel topic was updated

Type declaration

    • (data): void
    • Parameters

      • data: {
            channel: string;
            country?: string;
            id: number;
            professional: boolean;
            ranking: number;
            timestamp: number;
            topic: string;
            ui_class: string;
            username: string;
        }
        • channel: string

          The channel

        • Optional country?: string

          Country of the user that changed the topic

        • id: number

          User id of the user that changed the topic

        • professional: boolean

          If the user that changed the topic was a professional

        • ranking: number

          Ranking of the user that changed the topic

        • timestamp: number

          Timestamp (ms) of the topic change

        • topic: string

          The new topic

        • ui_class: string

          UI class of the user that changed the topic

        • username: string

          Username of the user that changed the topic

      Returns void

chat-update-user: ((data) => void)

A user's profile was updated

Type declaration

    • (data): void
    • Parameters

      • data: {
            channel: string;
            old_player_id: number;
            user: User;
        }
        • channel: string

          The channel

        • old_player_id: number

          Player id entry that was update. This might change in the case of a guest logging in, in this case this will switch from being a negative (guest) id, to some positive id. It is not expected that a non guest id should change using this system.

        • user: User

          New user details

      Returns void

game/:id/auto_resign: ((data) => void)

Informs the client the player is scheduled to resign if not cleared

Type declaration

    • (data): void
    • Parameters

      • data: {
            expiration: number;
            game_id: number;
            player_id: number;
        }
        • expiration: number

          When the auto resign will happen

        • game_id: number

          The game id

        • player_id: number

          The player id

      Returns void

game/:id/chat: ((data) => void)

A game chat message

Type declaration

game/:id/chat/remove: ((data) => void)

Game chat lines should be removed

Type declaration

    • (data): void
    • Parameters

      • data: {
            chat_ids: string[];
            game_id: number;
        }
        • chat_ids: string[]

          The chat ids

        • game_id: number

          The game id

      Returns void

game/:id/clear_auto_resign: ((data) => void)

The auto resign for the given player has been cleared

Type declaration

    • (data): void
    • Parameters

      • data: {
            game_id: number;
            player_id: number;
        }
        • game_id: number

          The game id

        • player_id: number

          The player id

      Returns void

game/:id/clock: ((data) => void)

Game clock update

Type declaration

    • (data): void
    • Parameters

      Returns void

game/:id/conditional_moves: ((data) => void)

Update the conditional moves currently active

Type declaration

    • (data): void
    • Parameters

      • data: {
            conditional_moves: ConditionalMoveResponse;
            game_id: number;
            move_number: number;
        }
        • conditional_moves: ConditionalMoveResponse

          The conditional moves. The top level should be an array that looks like [null, { ... }] where the second element contains the responses to the opponent's move.

        • game_id: number

          The game id

        • move_number: number

          The move number from which the conditional moves are rooted in

      Returns void

game/:id/error: ((data) => void)

Error that should be displayed to the user

Type declaration

    • (data): void
    • Parameters

      • data: string

      Returns void

game/:id/gamedata: ((data) => void)

Update the entire game state

Type declaration

game/:id/latency: ((data) => void)

Update latency information for a player

Type declaration

    • (data): void
    • Parameters

      • data: {
            game_id: number;
            latency: number;
            player_id: number;
        }
        • game_id: number

          The game id

        • latency: number

          The latency in milliseconds

        • player_id: number

          The player id

      Returns void

game/:id/phase: ((data) => void)

The phase has changed for the game

Type declaration

    • (data): void
    • Parameters

      • data: "play" | "stone removal" | "finished"

      Returns void

game/:id/removed_stones: ((data) => void)

Update the state of the stone removal phase

Type declaration

    • (data): void
    • Parameters

      • data: {
            all_removed: string;
            removed: boolean;
            stones: string;
        } | {
            strict_seki_mode: boolean;
        }

      Returns void

game/:id/removed_stones_accepted: ((data) => void)

The stone removal phase has been completed, this is the final state and indicates a phase change to the given phase (should always be "finished")

Type declaration

    • (data): void
    • Parameters

      • data: {
            end_time: number;
            outcome: string;
            phase: "finished";
            player_id: number;
            players: {
                black: User | {
                    accepted_stones: string;
                    accepted_strict_seki_mode: boolean;
                };
                white: User | {
                    accepted_stones: string;
                    accepted_strict_seki_mode: boolean;
                };
            };
            score: Score;
            stones: string;
            strict_seki_mode: boolean;
            winner: number;
        }
        • end_time: number

          Timestamp in ms

        • outcome: string

          Outcome of the game

        • phase: "finished"

          Game phase (finished

        • player_id: number
        • players: {
              black: User | {
                  accepted_stones: string;
                  accepted_strict_seki_mode: boolean;
              };
              white: User | {
                  accepted_stones: string;
                  accepted_strict_seki_mode: boolean;
              };
          }

          Current players and their accepted stone statuses

          • black: User | {
                accepted_stones: string;
                accepted_strict_seki_mode: boolean;
            }

            Active black player id

          • white: User | {
                accepted_stones: string;
                accepted_strict_seki_mode: boolean;
            }
        • score: Score

          Score

        • stones: string
        • strict_seki_mode: boolean

          True if Japanese strict seki mode was true. This will probably always be false and may be removed in the future.

        • winner: number

          Player id of the winner

      Returns void

game/:id/reset-chats: (() => void)

The chat log should be reset.

Type declaration

    • (): void
    • Returns void

game/:id/stalling_score_estimate: ((data?) => void)

A score estimation result has been broadcast, this is used for avoiding game stalling

Type declaration

game/:id/undo_accepted: ((data) => void)

Undo move has been accepted, the parameter is the new move number

Type declaration

    • (data): void
    • Parameters

      • data: number

      Returns void

game/:id/undo_canceled: ((data) => void)

Undo request has been canceled, the parameter is the move number of the original request

Type declaration

    • (data): void
    • Parameters

      • data: number

      Returns void

game/:id/undo_requested: ((data) => void)

Undo request has been requested, the parameter is the move number that we want to go back to

Type declaration

    • (data): void
    • Parameters

      • data: number

      Returns void

gamelist-count: ((data) => void)

Update number of live and correspondence games are currently being played

Type declaration

    • (data): void
    • Parameters

      • data: {
            correspondence: number;
            live: number;
        }
        • correspondence: number

          Number of correspondence games

        • live: number

          Number of live games

      Returns void

gamelist-count-:channel: ((data) => void)

Update number of live and correspondence games are currently being played in a particular channel

Type declaration

    • (data): void
    • Parameters

      • data: {
            correspondence: number;
            live: number;
        }
        • correspondence: number

          Number of correspondence games

        • live: number

          Number of live games

      Returns void

hostinfo: ((data) => void)

General host information for the termination server you are connected to. This is a response to the hostinfo client message.

Type declaration

    • (data): void
    • Parameters

      • data: {
            clients: number;
            hostname: string;
            uptime: number;
        }
        • clients: number

          Number of clients connected, if available

        • hostname: string

          The hostname of the server

        • uptime: number

          Number of seconds the server has been running

      Returns void

incident-report: ((data) => void)

Incident report update

Type declaration

    • (data): void
    • Parameters

      • data: {
            cleared_by_user?: boolean;
            created: string;
            id: number;
            moderator?: User;
            moderator_note: string;
            report_type: string;
            reported_conversation?: string;
            reported_game?: number;
            reported_review?: number;
            reported_user?: User;
            reporter_note: string;
            reporter_note_translation: {
                source_language: string;
                source_text: string;
                target_language: string;
                target_text: string;
            };
            reporting_user?: User;
            source: string;
            state: "pending" | "claimed" | "resolved";
            system_note: string;
            updated: string;
            url: string;
            was_helpful: boolean;
        }
        • Optional cleared_by_user?: boolean
        • created: string
        • id: number
        • Optional moderator?: User
        • moderator_note: string
        • report_type: string
        • Optional reported_conversation?: string
        • Optional reported_game?: number
        • Optional reported_review?: number
        • Optional reported_user?: User
        • reporter_note: string
        • reporter_note_translation: {
              source_language: string;
              source_text: string;
              target_language: string;
              target_text: string;
          }
          • source_language: string
          • source_text: string
          • target_language: string
          • target_text: string
        • Optional reporting_user?: User
        • source: string
        • state: "pending" | "claimed" | "resolved"
        • system_note: string
        • updated: string
        • url: string
        • was_helpful: boolean

      Returns void

itc: ((data) => void)

"Inter Tab Communication" message. This is a client utility to enable relaying of messages between devices - the event and data are application defined, the server blindly relays to all connected devices for the sending user. Note this is relayed to all devices regardless of client, so your application should be prepared to handle ITC messages from other applications, not just your own application. (For instance, the web client sending this will arrive on an android and ios instance)

Type declaration

    • (data): void
    • Parameters

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

          User defined data

        • event: string

          User defined event string

      Returns void

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

Pong response from a ping

Type declaration

    • (data): void
    • Parameters

      • data: {
            client: number;
            server: number;
        }
        • client: number

          Client timestamp that was sent

        • server: number

          Server timestamp when it was received

      Returns void

notification: ((data) => void)

A notification that should be displayed to the user These are not strongly modeled, see https://github.com/online-go/online-go.com/blob/devel/src/components/Notifications/Notifications.tsx as a reference for what types there are and what data they contain

Type declaration

    • (data): void
    • Parameters

      • data: {
            id: string;
            type: string;
            [key: string]: any;
        }
        • [key: string]: any

          There are often more fields here

        • id: string

          The notification id

        • type: string

          The notification type

      Returns void

private-message: ((data) => void)

A private message was received

Type declaration

    • (data): void
    • Parameters

      • data: {
            from: User;
            message: {
                i: string;
                m: string;
                t: number;
            };
            superchat_enabled?: boolean;
            to: User;
        }
        • from: User

          Who sent the message

        • message: {
              i: string;
              m: string;
              t: number;
          }

          The message received

          • i: string

            Message id.

          • m: string

            Message text

          • t: number

            Timestamp of the message

        • Optional superchat_enabled?: boolean

          If true, the private message should be forced to be in focus, this is when a moderator needs to talk with a player and ignoring the moderator is not suitable thing to do.

        • to: User

          Your user id

      Returns void

private-superchat: ((data) => void)

Notify the client that a private message "super chat" has started. A super chat is an undismissable chat sent by a moderator. It should take all focus and not let the client do anything until the conversation is resolved (the enable flag is set to false)

Type declaration

    • (data): void
    • Parameters

      • data: {
            enable: boolean;
            moderator_id: number;
            moderator_username: string;
            player_id: number;
            player_username: string;
        }
        • enable: boolean

          Whether the superchat is enabled or not. When true, the client should make an undismissable chat window, when false the window can be dismissed.

        • moderator_id: number

          The moderator id contacting the player

        • moderator_username: string

          The moderator username contacting the player

        • player_id: number

          Your id

        • player_username: string

          Your username

      Returns void

remote_storage/sync_complete: (() => void)

Notification that the server has completed sending all remote storage data and the client should now be up to date.

Type declaration

    • (): void
    • Returns void

remote_storage/update: ((data) => void)

Updates a key value pair

Type declaration

    • (data): void
    • Parameters

      • data: {
            key: string;
            modified: string;
            replication: RemoteStorageReplication;
            value: any;
        }
        • key: string

          Key for the k/v pair

        • modified: string

          Timestamp of the update

        • replication: RemoteStorageReplication

          Replication mode

        • value: any

          Value of of the k/v pair

      Returns void

review/:id/full_state: ((data) => void)

Replay of the entire full state of the review

Type declaration

review/:id/r: ((data) => void)

An incremental modification to the review stream

Type declaration

score-estimator-enabled-state: ((data) => void)

Notifies the client whether the the client shares an IP with one of the players of the game. This is used to disable the score estimator in anonymous browsing windows for players of a game when the score estimator is disabled for the game.

Type declaration

    • (data): void
    • Parameters

      • data: {
            game_id: number;
            shared_ip_with_player: boolean;
        }
        • game_id: number

          The game ID

        • shared_ip_with_player: boolean

          True if the client shares an IP with one of the players of the game

      Returns void

seekgraph/global: ((messages) => void)

Type declaration

ui-push: ((data) => void)

A UI Push notification. The event and data are not well defined here, they come as a result to subscribing to ui push channels with ui-pushes/subscribe.

Type declaration

    • (data): void
    • Parameters

      • data: {
            data: string;
            event: string;
        }
        • data: string

          UI Push data

        • event: string

          UI Push event

      Returns void

user/jwt: ((jwt) => void)

Update the user's JWT token

Type declaration

    • (jwt): void
    • Parameters

      • jwt: string

      Returns void

user/state: ((data) => void)

Updates whether a user is online or not. Subscribe to these updates for particular users using the user/monitor command.

Type declaration

    • (data): void
    • Parameters

      • data: {
            [player_id: number]: boolean;
        }
        • [player_id: number]: boolean

      Returns void

user/update: ((user) => void)

Update user information. For other players, this has the standard User fields, when this is the current user, it can have additional fields that are found in the ui/config

Type declaration

    • (user): void
    • Parameters

      • user: User & {
            [extra: string]: any;
        }

      Returns void