updated foundation with comments and better messages
This commit is contained in:
parent
f22e00e54a
commit
cf16991f01
|
|
@ -3,34 +3,34 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use uuid::Uuid;
|
||||
|
||||
/// # ClientMessage
|
||||
/// This enum defined the message that a client can receive from the server
|
||||
/// This enum defined the message that the server will receive from a client
|
||||
/// This uses the serde library to transform to and from json.
|
||||
///
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum ClientStreamIn {
|
||||
Connected,
|
||||
|
||||
Update,
|
||||
|
||||
|
||||
SendMessage { to: Uuid, content: String },
|
||||
SendGlobalMessage { content: String },
|
||||
|
||||
Disconnect,
|
||||
}
|
||||
|
||||
/// This enum defined the message that the server will send to a client
|
||||
/// This uses the serde library to transform to and from json.
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum ClientStreamOut {
|
||||
Connected,
|
||||
|
||||
ConnectedClients { clients: Vec<ClientDetails> },
|
||||
UserMessage { from: Uuid, content: String },
|
||||
GlobalMessage { from: Uuid, content: String },
|
||||
|
||||
ConnectedClients { clients: Vec<ClientDetails> },
|
||||
|
||||
Disconnected,
|
||||
|
||||
Connected,
|
||||
|
||||
// error cases
|
||||
Error,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
/// Message the server will receive from a socket
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum NetworkSockIn {
|
||||
|
|
@ -12,6 +13,7 @@ pub enum NetworkSockIn {
|
|||
},
|
||||
}
|
||||
|
||||
/// Message the server will send through a socket
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum NetworkSockOut {
|
||||
|
|
|
|||
Loading…
Reference in New Issue