Spring websocket - close a session in 60 seconds

We use websockets with apache-tomcat (8.0.15). Tomcat works for HAProxy, which has one timeout server 60s. We use spring -websocket (4.1.4.RELEASE). The problem we are facing is that sessions very often close.

We tried ping-pong between the client and the websocket server, where in the websocket client sends a (ping) message every 30 seconds:

["SEND\ncallback_id:1449064876903\ndestination:/app/data/ping\ncontent-length:2\n\n{}\u0000"]

and the server responds to pong:

a["MESSAGE\ndestination:/user/topic\ncontent-type:application/json;charset=UTF-8\nsubscription:sub-1\nmessage-id:vkgme6t7-33577\ncontent-length:68\n\n{\"message\":\"pong\"}\u0000"]

However, we often see the following logs:

[SubProtocolWebSocketHandler] - No messages received after 60215 ms. Closing XhrStreamingSockJsSession[id=xxxx].

Any ideas what is wrong?

+4
source share

Source: https://habr.com/ru/post/1618293/


All Articles