add: connect to socket by community
direct messages/groups connect by channel id, everything else should connect by channel with the "is_channel" header set to true
This commit is contained in:
parent
c1c8cdbfcd
commit
0304461389
20 changed files with 241 additions and 160 deletions
|
@ -371,19 +371,12 @@ pub struct ExternalConnectionInfo {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[derive(Default)]
|
||||
pub struct ExternalConnectionData {
|
||||
pub external_urls: HashMap<String, String>,
|
||||
pub data: HashMap<String, String>,
|
||||
}
|
||||
|
||||
impl Default for ExternalConnectionData {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
external_urls: HashMap::new(),
|
||||
data: HashMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Notification {
|
||||
|
|
|
@ -93,7 +93,7 @@ impl Message {
|
|||
created: now,
|
||||
edited: now,
|
||||
content,
|
||||
context: MessageContext::default(),
|
||||
context: MessageContext,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
use serde::{Serialize, Deserialize, de::DeserializeOwned};
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum PacketType {
|
||||
/// A regular check to ensure the connection is still alive.
|
||||
Ping,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum SocketMethod {
|
||||
/// Authentication and channel identification.
|
||||
|
@ -8,6 +14,8 @@ pub enum SocketMethod {
|
|||
Message,
|
||||
/// A message was deleted in the channel.
|
||||
Delete,
|
||||
/// Forward message from server to client. (Redis pubsub to ws)
|
||||
Forward(PacketType),
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue