1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Implement lobby parts of custom games #38

This commit is contained in:
NG (Graham)
2026-03-17 21:52:15 -04:00
parent af04c4093c
commit 6a953bc613
32 changed files with 1045 additions and 61 deletions

View File

@@ -13,7 +13,7 @@ pub async fn services_ws(req: HttpRequest, stream: Payload, auth: Data<super::In
*/
let (tx, mut rx) = tokio::sync::mpsc::channel(16);
reg.register_service(name.clone(), tx).await;
reg.register_web_service(name.clone(), tx).await;
log::debug!("Registered web services intercom websocket for user {}", name);
// start task but don't wait for it
@@ -39,7 +39,7 @@ pub async fn services_ws(req: HttpRequest, stream: Payload, auth: Data<super::In
}
if !is_ok {
reg.remove_service(name.clone()).await;
reg.remove_web_service(name.clone()).await;
}
rx.close();
session.close(Some(actix_ws::CloseReason {
@@ -58,6 +58,6 @@ pub async fn service_msg(req: HttpRequest, body: Json<oj_rc_core::persist::user:
log::debug!("Got intercom message from {} to {:?}", name, body.public_ids.as_slice());
auth.validate(&req, &format!(".oj_services/{}/messages", name))?;
log::debug!("Authenticated intercom message from {} to {:?}", name, body.public_ids.as_slice());
reg.broadcast_service_message(body.0).await;
reg.broadcast_web_service_message(body.0).await;
Ok(HttpResponse::NoContent().finish())
}