What to send in a Websocket ping and pong message | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 .

20th May 2022, 2:33 PM
Amal
Amal - avatar
1 Answer
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.
14th Apr 2024, 6:46 AM
`нттp⁴⁰⁶
`нттp⁴⁰⁶ - avatar