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
WebSocket not disconnecting when detached #31
Comments
Thanks for the bug report! Hm, if I understand the code correctly, that's not something you can do automatically because in principle there's no reference to the open socket in the head. Also, there could be several sockets! So it seems to me that the best solution would be to expose a way to run code when the head is detached. At least for Are you thinking of redefining the |
Sorry for the delay in responding, I got distracted :) So there is a reference to the socket inside the handler function in the head. So the solution I am using at the moment is to add a detach() method from inside the handler, which detaches the socket. |
Yeah, that probably makes sense. Are you going to prepare a PR? I'm a bit scared about potentially breaking tests (by changing the default behaviour), but the chances are probably ridiculously low, so I'm guessing we're fine. |
When a WebSocket head is disconnected, the websocket remains open. This is a problem if you have a long lived websocket and wish to change behaviour by swapping between heads.
It might be good to provide an option to allow disconnection when detached. I am happy to provide a PR for this issue if accepted.
The text was updated successfully, but these errors were encountered: