summary refs log tree commit diff
path: root/crates/messenger_common/src/client.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--crates/messenger_common/src/client.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crates/messenger_common/src/client.rs b/crates/messenger_common/src/client.rs
new file mode 100644
index 0000000..69a7fd6
--- /dev/null
+++ b/crates/messenger_common/src/client.rs
@@ -0,0 +1,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),
+}