summary refs log tree commit diff
path: root/crates/messenger_common/src/client.rs
blob: 69a7fd67a2dd0497522f637c18a1492adf7d1d36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Messages sent from the client to the server by the messenger.

use serde::{Deserialize, Serialize};

/// Represents the type of message being sent between the client and the server
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum MessageType {
	/// Sent when a user joins the chat. Contains the username they wish to pick
	SetUsername(String),

	/// Sent when a user sends a message in the chat. Contains their message as
	/// a string
	UserMessage(String),
}