Reputation: 125
I have a websocket implementation on Wakanda Server. I am tracking connected browsers server side. When I reload the page, I get the onclose event of the websocket as expected.
I would have expected when I break a network connection that I would also have this event fire. Am I misunderstanding? Is there a way to have a function fire when a network connection is lost to a websocket client?
For reference, I am using Wakanda 10.
Upvotes: 1
Views: 273
Reputation: 714
To help you understand the problem I will give you some details about websocket connections :
Upon receipt of a Ping frame, an endpoint MUST send a Pong frame in response, unless it already received a Close frame. It SHOULD respond with Pong frame as soon as is practical.
ping
messages but don't send our own ping
messagesThis can be a new feature where we can either :
ping
method through the message port
with a pong timeout
websocket handler
.websocket handler
.For the time being, you can send a message of your choice to the client side every N seconds and wait for a response with a timeout of T. If you don't receive a response you can assume the connexion is lost and close it.
Upvotes: 2