add: client streams api
fix: mobile chats ui
This commit is contained in:
parent
094dd5fdb5
commit
58d206eb81
12 changed files with 152 additions and 19 deletions
|
@ -4,6 +4,8 @@ use serde::{Serialize, Deserialize, de::DeserializeOwned};
|
|||
pub enum PacketType {
|
||||
/// A regular check to ensure the connection is still alive.
|
||||
Ping,
|
||||
/// General text which can be ignored.
|
||||
Text,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
||||
|
@ -16,6 +18,8 @@ pub enum SocketMethod {
|
|||
Delete,
|
||||
/// Forward message from server to client. (Redis pubsub to ws)
|
||||
Forward(PacketType),
|
||||
/// A general packet from client to server. (ws to Redis pubsub)
|
||||
Misc(PacketType),
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
@ -29,3 +33,9 @@ impl SocketMessage {
|
|||
serde_json::from_str(&self.data).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
/// [`PacketType::Text`]
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub struct TextMessage {
|
||||
pub text: String,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue