-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(socketioxide): disconnect handler #41
Conversation
…ince there were only `write()` calls
The `on_disconnect` fn will then be called with the reason in param.
Is there currently (in version 0.3.0) at least a way to check, whether a given socket is open or closed? (I don't see any.) |
- remove `thiserror::Error` from `DisconnectReason` - remove `HttpTransport` error from the `engineioxide::errors::Error` struct
socketioxide/src/client.rs
Outdated
); | ||
socket.close(); | ||
let reason: Option<EIoDisconnectReason> = err.into(); | ||
reason.map(|reason| socket.close(reason)); |
Check warning
Code scanning / clippy
called map(f) on an Option value where f is a closure that returns the unit type () Warning
Currently there is no way for the end user to execute code when the socket is disconnected.
Now, it will be possible to add an handler executed when the socket is disconnected:
There will be a
DisconnectReason
enum provided so the user knows what caused the disconnect event.Steps :
on_disconnect
handler on socketioxideSocket
.DisconnectReason
on engineioxideDisconnectReason
on socketioxideErrors provided forTransportError
variant on theDisconnectReason