This commit is contained in:
Edgar 2023-10-02 18:25:41 +02:00
parent 09375e6175
commit f3c1cf33c7
No known key found for this signature in database
GPG key ID: 70ADAE8F35904387

View file

@ -31,7 +31,10 @@ pub async fn ws_handler(
let rx = state.events_sender.subscribe(); let rx = state.events_sender.subscribe();
// finalize the upgrade process by returning upgrade callback. // finalize the upgrade process by returning upgrade callback.
// we can customize the callback by sending additional info such as address. // we can customize the callback by sending additional info such as address.
ws.on_upgrade(move |socket| handle_socket(socket, addr, rx)) ws.on_failed_upgrade(|error| {
error!("error upgrading connection: {error}");
})
.on_upgrade(move |socket| handle_socket(socket, addr, rx))
} }
/// Actual websocket statemachine (one will be spawned per connection) /// Actual websocket statemachine (one will be spawned per connection)