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:
parent
fa3017ce44
commit
6ca7916012
4 changed files with 75 additions and 62 deletions
|
|
@ -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),
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Reference in a new issue