2 followers Follow

websocket server closes client connection in 30 seconds

We have a c# based websocket client connecting to spring websocket server.

After the connection is established, we can see the ping/pong messages between the two entities. Then in 30 seconds, the Spring WebSocket server sent a connection close request. Any scenario that may cause this?


Yingqiu Liu

Please sign in to leave a comment.

1 comment


The first thing that comes to mind would be if the connection becomes idle.  In that case, I could see the server closing it.  You mentioned seeing ping/pong requests.  Are these consistent or are they running and stopping?  If they're consistently running up to the 30s mark when the connection closes then the connection is probably not being closed because of an idle time issue.  In that case, maybe check the logs to see what happening?  You could try turning up the log level for `org.springframework.web` to DEBUG.  That might show more info when the server ends the connection.

Outside of that:

  • Try a different WebSocket client and see if it behaves the same?  For example, try with Chrome.
  • Post an example.  If you can replicate the problem, add or link to an example and I can take a closer look to see what's happening.

Hope that helps!


Daniel Mikusa 0 votes