0
What to send in a Websocket ping and pong message
Hi , i making a live stream for stocks / currency . In a Websocket cause the reaction speed is faster and its on every second . When the stream is running i received a ping = > 'b. ' Nothing else . So What must i send from the ping ? And when tot send a pong ? The docs online are not good .
1 Respuesta
0
For the ping message, you can send any simple response like "pong" or even just an empty message to acknowledge the receipt of the ping. This can be useful for maintaining the connection alive and checking the responsiveness.
You should send a pong message back promptly after receiving a ping. This confirms to the sender that the connection is active and responsive, helping to ensure smooth real-time communication in your live stream application. Remember, in WebSockets, a ping message is typically followed by a pong message for connection health monitoring.