add: broadcast socket id for user sockets

This commit is contained in:
trisua 2025-05-02 23:29:38 -04:00
parent ecde5d3d46
commit 1724f798ca
6 changed files with 48 additions and 16 deletions

View file

@ -456,6 +456,18 @@ pub async fn handle_socket(socket: WebSocket, db: DataManager, user_id: String,
// get channel permissions
let channel = format!("{user_id}/{stream_id}");
// identify socket
sink.send(WsMessage::Text(
serde_json::to_string(&SocketMessage {
method: SocketMethod::Forward(PacketType::Key),
data: socket_id.clone(),
})
.unwrap()
.into(),
))
.await
.unwrap();
// ...
let mut recv_task = tokio::spawn(async move {
while let Some(Ok(WsMessage::Text(text))) = stream.next().await {