package app.playmancala.model; // WebSocket channel names; must match packages/core/src/rtmt/channel_names.ts. public final class Channels { public static final String NEW_GAME = "new_game"; public static final String CANCEL_NEW_GAME = "cancel_new_game"; // client -> server: { level }, starts a game against the bot at that level (docs/specs/game-bot). public static final String NEW_BOT_GAME = "new_bot_game"; public static final String ON_GAME_START = "on_game_start"; public static final String GAME_MOVE = "game_move"; public static final String ON_GAME_UPDATE = "on_game_update"; public static final String LEAVE_GAME = "leave_game"; public static final String ON_GAME_END = "on_game_end"; public static final String ON_GAME_CRASHED = "on_game_crashed"; public static final String ON_GAME_USER_LEAVE = "on_game_user_leave"; public static final String PING = "ping"; public static final String PONG = "pong"; public static final String ON_USER_CONNECTION_CHANGE = "channel_on_user_connection_change"; public static final String LISTEN_GAME_EVENTS = "channel_listen_game_events"; public static final String UNLISTEN_GAME_EVENTS = "channel_unlisten_game_events"; // Auth handshake. client -> server: { token } right after connecting and again after a token refresh; // other messages are ignored until the server answers on_auth with { user }. public static final String AUTH = "auth"; public static final String ON_AUTH = "on_auth"; // server -> client: { reason }, sent right before the server closes the socket with CLOSE_AUTH_FAILED. public static final String ON_AUTH_ERROR = "on_auth_error"; public static final int CLOSE_AUTH_FAILED = 4001; // Home page previews. client -> server: subscribe_live_games / unsubscribe_live_games; // server -> client: on_live_games with { games: LiveGameSummary[] }. public static final String SUBSCRIBE_LIVE_GAMES = "subscribe_live_games"; public static final String UNSUBSCRIBE_LIVE_GAMES = "unsubscribe_live_games"; public static final String ON_LIVE_GAMES = "on_live_games"; // server -> client: { gameId }, when new_game is sent while the user has a game in progress. public static final String ON_NEW_GAME_REJECTED = "on_new_game_rejected"; private Channels() { } }