pub enum ClientMessage {
Show 14 variants
Authenticate {
app_id: String,
sdk_version: Option<String>,
platform: Option<String>,
game_data_format: Option<GameDataEncoding>,
protocol_version: Option<u16>,
supported_transports: Option<Vec<TransportKind>>,
supported_topologies: Option<Vec<Topology>>,
},
JoinRoom {
game_name: String,
room_code: Option<String>,
player_name: String,
max_players: Option<u8>,
supports_authority: Option<bool>,
relay_transport: Option<RelayTransport>,
},
LeaveRoom,
GameData {
data: Value,
class: Option<DeliveryClass>,
key: Option<u32>,
},
AuthorityRequest {
become_authority: bool,
},
PlayerReady,
ProvideConnectionInfo {
connection_info: ConnectionInfo,
},
Ping,
Reconnect {
player_id: PlayerId,
room_id: RoomId,
auth_token: String,
},
JoinAsSpectator {
game_name: String,
room_code: String,
spectator_name: String,
},
LeaveSpectator,
StartGame,
Signal {
to: PlayerId,
signal: Value,
},
TransportStatus {
transport: TransportKind,
connected: bool,
},
}Expand description
Message types sent from client to server.
Variants§
Authenticate
Authenticate with App ID (MUST be first message). App ID is a public identifier (not a secret!) that identifies the game application.
Fields
game_data_format: Option<GameDataEncoding>Preferred game data encoding (defaults to JSON text frames).
protocol_version: Option<u16>Highest protocol version the client speaks (protocol v3+).
Omitted by default so the server treats the client as v2 relay-only and the wire bytes stay identical to v2.
supported_transports: Option<Vec<TransportKind>>Data-path transports the client can actually fulfill (protocol v3+).
JoinRoom
Join or create a room for a specific game.
Fields
relay_transport: Option<RelayTransport>Preferred relay transport protocol (TCP, UDP, or Auto). If not specified, defaults to Auto.
LeaveRoom
Leave the current room.
GameData
Send game data to other players in the room.
AuthorityRequest
Request to become or connect to authoritative server.
Fields
PlayerReady
Signal readiness to start the game in lobby.
ProvideConnectionInfo
Provide connection info for P2P establishment.
Fields
connection_info: ConnectionInfoPing
Heartbeat to maintain connection.
Reconnect
Reconnect to a room after disconnection.
Fields
JoinAsSpectator
Join a room as a spectator (read-only observer).
LeaveSpectator
Leave spectator mode.
StartGame
Explicitly start the game, finalizing the lobby with its current members (protocol v2).
Accepted only when every current player is ready. If the room has a
designated authority, only that authority may start; otherwise any
member may. On success the server broadcasts GameStarting (and, for a
negotiated v3 non-relay room, a per-recipient SessionPlan).
Signal
Relay an opaque WebRTC signal to a single peer.
Protocol v3 only. Rejected on a relay-floor (v2) connection.
The signal is forwarded verbatim by the server. It is typically a
PeerSignal ({"Offer"|"Answer"|"IceCandidate": …})
but is modeled as serde_json::Value so unknown future shapes never
fail to round-trip.
Fields
TransportStatus
Report whether a data-path transport to peers is currently established.
Protocol v3 only. Informational; the server fans it out as
PeerTransportStatus and uses it for fallback decisions.
Fields
transport: TransportKindThe transport being reported on.
Trait Implementations§
Source§impl Clone for ClientMessage
impl Clone for ClientMessage
Source§fn clone(&self) -> ClientMessage
fn clone(&self) -> ClientMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more