antenna_client_shared/signaling.rs
1use serde::{Deserialize, Serialize};
2
3/// WebSocket frame sent from a signaling client to the bundled signaling server.
4#[derive(Debug, Clone, Serialize, Deserialize)]
5#[serde(tag = "type", rename_all = "snake_case")]
6pub enum ClientMsg<'a> {
7 /// Enter (or create) a room.
8 Join { room_id: &'a str },
9 /// Reply to `RequestOffer` with the SDP offer string.
10 Offer { room_id: &'a str, offer: &'a str },
11 /// Reply to `OfferReceived` with the SDP answer string.
12 Answer { room_id: &'a str, answer: &'a str },
13 /// Leave the room (also implied by closing the WebSocket).
14 Disconnect { room_id: &'a str },
15}
16
17/// WebSocket frame sent from the signaling server to a client.
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(tag = "type", rename_all = "snake_case")]
20pub enum ServerMsg<'a> {
21 /// "You are the host of this pairing — produce an offer and send it back."
22 RequestOffer,
23 /// "You are the joiner — produce an answer to this offer."
24 OfferReceived { offer: &'a str },
25 /// "Your offer was accepted, here is the joiner's answer."
26 AnswerReceived { answer: &'a str },
27 /// Server-side failure (room full, malformed frame, etc.).
28 Error { message: &'a str },
29}