When I obtain market data through the websocket stream in the Java language, how to send pong message frames to maintain connectivity? I tried using the websocket API to send pong frames, but the server prompted: {“error”: {“code”: 2, “msg”: “Invalid request: unknown variant ‘pong’, expected one of ‘SUSCRIBE’, ‘UNSUBSCRIBE’, ‘LISTSUBSCRIPTIONS’,’ SET_PROPERTY ‘,’ GET_PROPERTY 'at line 1 column 16”} -
Ping pong at Binance follow the standard protocol, please find the specific at RFC 6455 - The WebSocket Protocol
You can check the websocket library that you use, it may has the ping pong methods already.
Thank you for your reply. I have studied the websocket of OKHTTP and found that it will automatically send pong frames, which should be my network issue