I always thought it's the responsibility of the client to send a ping message to make sure server is available or handle disconnection in a proper way.
But lately I read an article where the initiator of ping messages is server side. So, server sends ping and client should respond with pong if it can.
What's the more general universal approach and why?
According to the websocket RFC - examples, it shows Unmasked Ping request (Ping frame) and masked Ping response (Pong frame) where Ping is from server and Pong is from client.
But, Ping and Pong sections mention "endpoint" which can be either client or server.
So, client and server both should be able to send Ping frame and the other party should reply with Pong frame.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With