feat: Chat request implementation #14

Manually merged
awiteb merged 55 commits from awiteb/chat-request-and-response into master 2024-07-18 14:21:39 +02:00 AGit
Showing only changes of commit ff37501b74 - Show all commits

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 {