pub enum ServerMessage {
Show 24 variants
Authenticated {
app_name: String,
organization: Option<String>,
rate_limits: RateLimitInfo,
},
ProtocolInfo(ProtocolInfoPayload),
AuthenticationError {
error: String,
error_code: ErrorCode,
},
RoomJoined(Box<RoomJoinedPayload>),
RoomJoinFailed {
reason: String,
error_code: Option<ErrorCode>,
},
RoomLeft,
PlayerJoined {
player: PlayerInfo,
},
PlayerLeft {
player_id: PlayerId,
},
GameData {
from_player: PlayerId,
data: Value,
},
GameDataBinary {
from_player: PlayerId,
encoding: GameDataEncoding,
payload: Vec<u8>,
},
AuthorityChanged {
authority_player: Option<PlayerId>,
you_are_authority: bool,
},
AuthorityResponse {
granted: bool,
reason: Option<String>,
error_code: Option<ErrorCode>,
},
LobbyStateChanged {
lobby_state: LobbyState,
ready_players: Vec<PlayerId>,
all_ready: bool,
},
GameStarting {
peer_connections: Vec<PeerConnectionInfo>,
},
Pong,
Reconnected(Box<ReconnectedPayload>),
ReconnectionFailed {
reason: String,
error_code: ErrorCode,
},
PlayerReconnected {
player_id: PlayerId,
},
SpectatorJoined(Box<SpectatorJoinedPayload>),
SpectatorJoinFailed {
reason: String,
error_code: Option<ErrorCode>,
},
SpectatorLeft {
room_id: Option<RoomId>,
room_code: Option<String>,
reason: Option<SpectatorStateChangeReason>,
current_spectators: Vec<SpectatorInfo>,
},
NewSpectatorJoined {
spectator: SpectatorInfo,
current_spectators: Vec<SpectatorInfo>,
reason: Option<SpectatorStateChangeReason>,
},
SpectatorDisconnected {
spectator_id: PlayerId,
reason: Option<SpectatorStateChangeReason>,
current_spectators: Vec<SpectatorInfo>,
},
Error {
message: String,
error_code: Option<ErrorCode>,
},
}Expand description
Message types sent from server to client.
Variants§
Authenticated
Authentication successful.
Fields
rate_limits: RateLimitInfoRate limits for this app.
ProtocolInfo(ProtocolInfoPayload)
SDK/protocol compatibility details advertised after authentication.
AuthenticationError
Authentication failed.
RoomJoined(Box<RoomJoinedPayload>)
Successfully joined a room (boxed to reduce enum size).
RoomJoinFailed
Failed to join room.
RoomLeft
Successfully left room.
PlayerJoined
Another player joined the room.
Fields
player: PlayerInfoPlayerLeft
Another player left the room.
GameData
Game data from another player.
GameDataBinary
Binary game data payload from another player.
Uses Vec<u8> with serde_bytes for efficient serialization.
AuthorityChanged
Authority status changed.
Fields
AuthorityResponse
Authority request response.
LobbyStateChanged
Lobby state changed (room full, player readiness changed, etc.).
GameStarting
Game is starting with peer connection information.
Fields
peer_connections: Vec<PeerConnectionInfo>Pong
Pong response to ping.
Reconnected(Box<ReconnectedPayload>)
Reconnection successful (boxed to reduce enum size).
ReconnectionFailed
Reconnection failed.
PlayerReconnected
Another player reconnected to the room.
SpectatorJoined(Box<SpectatorJoinedPayload>)
Successfully joined a room as spectator (boxed to reduce enum size).
SpectatorJoinFailed
Failed to join as spectator.
SpectatorLeft
Successfully left spectator mode.
NewSpectatorJoined
Another spectator joined the room.
Fields
spectator: SpectatorInfocurrent_spectators: Vec<SpectatorInfo>reason: Option<SpectatorStateChangeReason>SpectatorDisconnected
Another spectator left the room.
Error
Error message.
Trait Implementations§
Source§impl Clone for ServerMessage
impl Clone for ServerMessage
Source§fn clone(&self) -> ServerMessage
fn clone(&self) -> ServerMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more