Skip to content
Discussion options

You must be logged in to vote

This is brought up in the user manual; WebSockets are valid from open event to close event. That exception you get, "Invalid access of closed uWS.WebSocket..." is not something you should try/catch - it's a hint that you are using the library wrong. Once you get the close event, you can no longer use the WebSocket whatsoever (it is dead).

This means if you have a data structure that holds sockets in a lobby you have to properly remove all references to the dead WebSocket from that data structure so that you don't access it by mistake.

There is no way to "check" if a WebSocket is dead or not, you have to properly make use the the open/close events to update whatever data structures you have.

Replies: 12 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #248 on December 09, 2020 05:52.