Stay Connected
WebSocket uses the Ping/Pong mechanism to maintain the connection. Once the connection is opened, a Ping frame is sent every N seconds, and the remote endpoint will return a Pong frame to keep responding. This is an approach to stay active. It helps to keep the connection open, especially if there is a short timeout proxy on an inactive connection.
If no data is returned after connecting to WebSocket, the link will be automatically disconnected after 20s. It is recommended that the user do the following:
After each message is received, the user sets a timer for N seconds (N<20).
If the timer is triggered (no new message is received within N seconds), send a ping frame or send a string 'ping'.
The following is the data format of ping
1.Standard Ping frame
ws.send(new PingWebSocketFrame();
2.Ping Text
ws.send(new TextWebSocketFrame("ping");
Note
If there is a network problem, the connection will be automatically disconnected, please set up the reconnection mechanism
Connection Limit
Connection limit: 1 times /1 second
To prevent malicious hogging of connections, only one connection per second is allowed per IP.
Subscription limit: 60 times /10 minutes
After a successful connection, to prevent malicious transmission of data, limit each connection to send 60 subscription data within 10 minutes.
Lifeless connection
Connection that do not send task subscription data within 5 minutes will be considered lifeless and the server will close the connection.