From ff37501b74215a211ae3458c8cc3694ca7f07966 Mon Sep 17 00:00:00 2001
From: Awiteb
Date: Fri, 12 Jul 2024 23:13:50 +0300
Subject: [PATCH] feat: New event called `ChatRequest`
Signed-off-by: Awiteb
---
crates/oxidetalis/src/websocket/events/client.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/crates/oxidetalis/src/websocket/events/client.rs b/crates/oxidetalis/src/websocket/events/client.rs
index a4dda31..23b8586 100644
--- a/crates/oxidetalis/src/websocket/events/client.rs
+++ b/crates/oxidetalis/src/websocket/events/client.rs
@@ -16,7 +16,7 @@
//! Events that the client send it
-use oxidetalis_core::types::Signature;
+use oxidetalis_core::types::{PublicKey, Signature};
use serde::{Deserialize, Serialize};
use crate::{nonce::NonceCache, utils};
@@ -24,6 +24,7 @@ use crate::{nonce::NonceCache, utils};
/// Client websocket event
#[derive(Deserialize, Clone, Debug)]
pub struct ClientEvent {
+ #[serde(flatten)]
pub event: ClientEventType,
signature: Signature,
}
@@ -36,6 +37,8 @@ pub enum ClientEventType {
Ping { timestamp: u64 },
/// Pong event
Pong { timestamp: u64 },
+ /// Request to chat with a user
+ ChatRequest { to: PublicKey },
}
impl ClientEventType {