1
0
mirror of https://github.com/pcvolkmer/arsnova-client.git synced 2025-04-19 19:16:51 +00:00

add WsSubscribeMessage struct

This commit is contained in:
Paul-Christian Volkmer 2024-12-16 23:40:00 +01:00
parent 1769809e1a
commit 45166015ea

View File

@ -81,6 +81,28 @@ impl Display for WsConnectMessage {
} }
} }
struct WsSubscribeMessage {
room_id: String,
}
impl WsSubscribeMessage {
fn new(room_id: &str) -> WsSubscribeMessage {
WsSubscribeMessage {
room_id: room_id.to_string(),
}
}
}
impl Display for WsSubscribeMessage {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
let str = format!(
"SUBSCRIBE\nid:sub-6\ndestination:/topic/{}.stream\n\n\0",
self.room_id
);
write!(f, "{}", str)
}
}
struct WsSubscribeFeedbackMessage { struct WsSubscribeFeedbackMessage {
room_id: String, room_id: String,
} }