rust-socketio icon indicating copy to clipboard operation
rust-socketio copied to clipboard

feat(socketio): notify client of transport completion

Open sirkrypt0 opened this issue 1 year ago • 1 comments

When the async client connects to the server, it spawns a new thread to handle the arriving messages asynchronously, which is immediately detached with no chance of awaiting its completion.

For long-running programs (e.g. a client program that never really disconnects from the server) this can be problematic, as unexpected stream completions would go unnoticed. This may happen if the underlying tungstenite websocket shuts down ('Received close frame: None') but there are no engineio/socketio close frames. Hence, since the stream terminates, the message handling task stops without a Close or Error event being fired.

Thus, we now fire an additional Event::Close when the stream terminates, to signal the (potentially unexpected) close to the user.

Closes #448

Once we settle on a final solution, I can also write a test for that.

sirkrypt0 avatar Jul 16 '24 14:07 sirkrypt0

Are there any remaining problems with this? This looks like it solves exactly what I need.

MnlPhlp avatar Aug 13 '24 09:08 MnlPhlp