feat: private messages.
This commit is contained in:
parent
0492043625
commit
22cc0fdc38
11 changed files with 1135 additions and 44 deletions
|
|
@ -7,6 +7,12 @@ use uuid::Uuid;
|
|||
|
||||
use crate::models::{AvatarRenderData, ChannelMemberInfo, ChannelMemberWithAvatar, LooseProp};
|
||||
|
||||
/// Default function for serde that returns true (for is_same_scene field).
|
||||
/// Must be pub for serde derive macro to access via full path.
|
||||
pub fn default_is_same_scene() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// WebSocket configuration sent to client on connect.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct WsConfig {
|
||||
|
|
@ -47,10 +53,13 @@ pub enum ClientMessage {
|
|||
/// Ping to keep connection alive.
|
||||
Ping,
|
||||
|
||||
/// Send a chat message to the channel.
|
||||
/// Send a chat message to the channel or directly to a user.
|
||||
SendChatMessage {
|
||||
/// Message content (max 500 chars).
|
||||
content: String,
|
||||
/// Target display name for direct whisper. None = broadcast to scene.
|
||||
#[serde(default)]
|
||||
target_display_name: Option<String>,
|
||||
},
|
||||
|
||||
/// Drop a prop from inventory to the canvas.
|
||||
|
|
@ -154,6 +163,16 @@ pub enum ServerMessage {
|
|||
y: f64,
|
||||
/// Server timestamp (milliseconds since epoch).
|
||||
timestamp: i64,
|
||||
/// Whether this is a whisper (direct message).
|
||||
/// Default: false (broadcast message).
|
||||
#[serde(default)]
|
||||
is_whisper: bool,
|
||||
/// Whether sender is in the same scene as recipient.
|
||||
/// For whispers: true = same scene (show as bubble), false = cross-scene (show as notification).
|
||||
/// For broadcasts: always true.
|
||||
/// Default: true (same scene).
|
||||
#[serde(default = "self::default_is_same_scene")]
|
||||
is_same_scene: bool,
|
||||
},
|
||||
|
||||
/// Initial list of loose props when joining channel.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue