use serde::{Deserialize, Serialize};
use ws_bridge::WsEndpoint;
pub struct EchoEndpoint;
impl WsEndpoint for EchoEndpoint {
const PATH: &'static str = "/ws/echo";
type ServerMsg = ServerMsg;
type ClientMsg = ClientMsg;
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum ServerMsg {
Welcome { message: String },
Echo { payload: String },
Error { message: String },
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum ClientMsg {
Say { text: String },
Quit,
}