Changeset View
Changeset View
Standalone View
Standalone View
services/tunnelbroker/src/websockets/mod.rs
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | async fn accept_connection(raw_stream: TcpStream, addr: SocketAddr) { | ||||
} | } | ||||
} | } | ||||
fn handle_message( | fn handle_message( | ||||
message: &str, | message: &str, | ||||
tx: &tokio::sync::mpsc::UnboundedSender<std::string::String>, | tx: &tokio::sync::mpsc::UnboundedSender<std::string::String>, | ||||
) -> Result<(), serde_json::Error> { | ) -> Result<(), serde_json::Error> { | ||||
match serde_json::from_str::<Messages>(message)? { | match serde_json::from_str::<Messages>(message)? { | ||||
Messages::SessionRequest(session_info) => { | Messages::ConnectionInitializationMessage(session_info) => { | ||||
ACTIVE_CONNECTIONS.insert(session_info.device_id, tx.clone()); | ACTIVE_CONNECTIONS.insert(session_info.device_id, tx.clone()); | ||||
} | } | ||||
_ => { | _ => { | ||||
debug!("Received invalid request"); | debug!("Received invalid request"); | ||||
} | } | ||||
} | } | ||||
Ok(()) | Ok(()) | ||||
Show All 23 Lines |