feat: New event called ChatRequest

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb 2024-07-12 23:13:50 +03:00
parent 8333a6ba9a
commit ff37501b74
Signed by: awiteb
GPG key ID: 3F6B55640AA6682F

View file

@ -16,7 +16,7 @@
//! Events that the client send it //! Events that the client send it
use oxidetalis_core::types::Signature; use oxidetalis_core::types::{PublicKey, Signature};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{nonce::NonceCache, utils}; use crate::{nonce::NonceCache, utils};
@ -24,6 +24,7 @@ use crate::{nonce::NonceCache, utils};
/// Client websocket event /// Client websocket event
#[derive(Deserialize, Clone, Debug)] #[derive(Deserialize, Clone, Debug)]
pub struct ClientEvent { pub struct ClientEvent {
#[serde(flatten)]
pub event: ClientEventType, pub event: ClientEventType,
signature: Signature, signature: Signature,
} }
@ -36,6 +37,8 @@ pub enum ClientEventType {
Ping { timestamp: u64 }, Ping { timestamp: u64 },
/// Pong event /// Pong event
Pong { timestamp: u64 }, Pong { timestamp: u64 },
/// Request to chat with a user
ChatRequest { to: PublicKey },
} }
impl ClientEventType { impl ClientEventType {