mirror of
https://github.com/pcvolkmer/arsnova-client.git
synced 2025-04-19 19:16:51 +00:00
refactor: rename websocket subscription message
This commit is contained in:
parent
96c90e7f0e
commit
97528b217c
@ -81,18 +81,28 @@ impl Display for WsConnectMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WsSubscribeMessage {
|
struct WsSubscribeFeedbackMessage {
|
||||||
room_id: String,
|
room_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WsSubscribeMessage {
|
impl WsSubscribeFeedbackMessage {
|
||||||
fn new(room_id: &str) -> WsSubscribeMessage {
|
fn new(room_id: &str) -> WsSubscribeFeedbackMessage {
|
||||||
WsSubscribeMessage {
|
WsSubscribeFeedbackMessage {
|
||||||
room_id: room_id.to_string(),
|
room_id: room_id.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Display for WsSubscribeFeedbackMessage {
|
||||||
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||||
|
let str = format!(
|
||||||
|
"SUBSCRIBE\nid:sub-6\ndestination:/topic/{}.feedback.stream\n\n\0",
|
||||||
|
self.room_id
|
||||||
|
);
|
||||||
|
write!(f, "{}", str)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct WsFeedbackMessage {
|
struct WsFeedbackMessage {
|
||||||
body: WsFeedbackBody,
|
body: WsFeedbackBody,
|
||||||
@ -164,16 +174,6 @@ impl Display for WsCreateFeedbackMessage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for WsSubscribeMessage {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
||||||
let str = format!(
|
|
||||||
"SUBSCRIBE\nid:sub-6\ndestination:/topic/{}.feedback.stream\n\n\0",
|
|
||||||
self.room_id
|
|
||||||
);
|
|
||||||
write!(f, "{}", str)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct RoomInfo {
|
pub struct RoomInfo {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
@ -519,7 +519,7 @@ impl Client<LoggedIn> {
|
|||||||
{
|
{
|
||||||
return match write
|
return match write
|
||||||
.send(Message::Text(
|
.send(Message::Text(
|
||||||
WsSubscribeMessage::new(&room_info.id).to_string(),
|
WsSubscribeFeedbackMessage::new(&room_info.id).to_string(),
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
@ -571,7 +571,7 @@ impl Client<LoggedIn> {
|
|||||||
{
|
{
|
||||||
match write
|
match write
|
||||||
.send(Message::Text(
|
.send(Message::Text(
|
||||||
WsSubscribeMessage::new(&room_info.id).to_string(),
|
WsSubscribeFeedbackMessage::new(&room_info.id).to_string(),
|
||||||
))
|
))
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user