add: broadcast socket id for user sockets
This commit is contained in:
parent
ecde5d3d46
commit
1724f798ca
6 changed files with 48 additions and 16 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue