RematchOffers keeps an offer open for ten minutes after a game nobody left. A request goes to the opponent; when both have asked the next game of the series starts with the other player moving first. Requests end on no, withdrawal, a minute without answer, going offline or looking for another game. The bot accepts at once.
47 lines
2.9 KiB
Java
47 lines
2.9 KiB
Java
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";
|
|
// Rematches (docs/specs/rematch). client -> server: rematch { gameId } asks for a rematch of an ended game or
|
|
// accepts the opponent's request; decline_rematch { gameId } says no or withdraws one's own request.
|
|
// server -> client: on_rematch_request { gameId } when the opponent asks; on_rematch_ended { gameId, reason } to
|
|
// both players when a request or the chance of a rematch ends.
|
|
public static final String REMATCH = "rematch";
|
|
public static final String DECLINE_REMATCH = "decline_rematch";
|
|
public static final String ON_REMATCH_REQUEST = "on_rematch_request";
|
|
public static final String ON_REMATCH_ENDED = "on_rematch_ended";
|
|
|
|
private Channels() {
|
|
}
|
|
}
|