add: client streams api

fix: mobile chats ui
This commit is contained in:
trisua 2025-05-01 23:35:40 -04:00
parent 094dd5fdb5
commit 58d206eb81
12 changed files with 152 additions and 19 deletions

View file

@ -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,
}