Expand description
RuneCast Protocol Library
This crate defines the WebSocket protocol for RuneCast, including:
- Client-to-server message types
- Server-to-client message types
- Shared data types (
Grid,Position,PlayerInfo, etc.) - Player identity and context types
§Usage
use runecast_protocol::protocol::{ClientMessage, ServerMessage};
// Parse an incoming client message
let json = r#"{"type":"heartbeat"}"#;
let msg: ClientMessage = serde_json::from_str(json).unwrap();
// Create a server response
let response = ServerMessage::HeartbeatAck {
server_time: 1701234567890,
};
// Serialize it for the wire
let wire = serde_json::to_string(&response).unwrap();
assert!(wire.contains(r#""type":"heartbeat_ack""#));Re-exports§
pub use player::PlayerContext;pub use player::PlayerIdentity;pub use protocol::client_messages::ClientMessage;pub use protocol::server_messages::ServerMessage;pub use protocol::types::default_dictionary;pub use protocol::types::AdminGameInfo;pub use protocol::types::AdventureEventKind;pub use protocol::types::BotDifficulty;pub use protocol::types::BotSpec;pub use protocol::types::BuildInfo;pub use protocol::types::ConnectKind;pub use protocol::types::ConnectParams;pub use protocol::types::CustomMeta;pub use protocol::types::DebugBackendGameState;pub use protocol::types::DebugHandlerGameState;pub use protocol::types::DebugLobbyState;pub use protocol::types::DebugPlayerInfo;pub use protocol::types::DebugWebsocketContext;pub use protocol::types::ErrorCode;pub use protocol::types::EventConfig;pub use protocol::types::GameConfig;pub use protocol::types::GamePlayerInfo;pub use protocol::types::GameSnapshot;pub use protocol::types::GameState;pub use protocol::types::GameSummary;pub use protocol::types::Grid;pub use protocol::types::GridCell;pub use protocol::types::LobbyChange;pub use protocol::types::LobbyGameInfo;pub use protocol::types::LobbyGamePlayerInfo;pub use protocol::types::LobbyPlayerInfo;pub use protocol::types::LobbyType;pub use protocol::types::ModeCap;pub use protocol::types::Multiplier;pub use protocol::types::PlayerInfo;pub use protocol::types::PlayerName;pub use protocol::types::Position;pub use protocol::types::RuneBoxStanding;pub use protocol::types::ScoreInfo;pub use protocol::types::SpectatorInfo;pub use protocol::types::TimerVoteState;pub use protocol::types::TurnPassReason;pub use protocol::types::MAIN_DICTIONARY;pub use protocol::LobbySnapshot;