Handle both numerical and binary pings.

This commit is contained in:
Paul
2021-09-11 12:43:26 +01:00
parent 06f968022d
commit fa8eb874d0
2 changed files with 11 additions and 3 deletions

View File

@@ -22,13 +22,20 @@ pub struct Auth {
pub token: String,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum Ping {
Binary(Vec<u8>),
Number(usize)
}
#[derive(Deserialize, Debug)]
#[serde(tag = "type")]
pub enum ServerboundNotification {
Authenticate(Auth),
BeginTyping { channel: String },
EndTyping { channel: String },
Ping { data: Vec<u8>, responded: Option<()> },
Ping { data: Ping, responded: Option<()> },
}
#[derive(Serialize, Deserialize, Debug, Clone)]
@@ -79,7 +86,7 @@ pub enum ClientboundNotification {
channels: Vec<Channel>,
members: Vec<Member>,
},
Pong { data: Vec<u8> },
Pong { data: Ping },
Message(Message),
MessageUpdate {