feat: websocket authentication now takes place in the websocket instead of using headers, for broader API compatibility

eg Javascript WebSocket API
This commit is contained in:
Ninjdai 2025-08-07 17:25:55 +02:00
parent fa3017ce44
commit 6ca7916012
4 changed files with 75 additions and 62 deletions

View file

@ -12,6 +12,7 @@ pub enum Event {
#[derive(Clone, Debug)]
pub enum WebsocketMessage {
NewOwner(Arc<owner::Model>),
Error(String),
Ping
}
@ -20,10 +21,12 @@ impl WebsocketMessage {
json!({
"type": match self {
Self::NewOwner(_) => "new_owner",
Self::Error(_) => "error",
Self::Ping => "ping",
},
"data": match self {
Self::NewOwner(owner) => json!(owner),
Self::Error(error) => json!(error),
Self::Ping => json!(null),
}
})