Description
Hello, We using spring websocket in stomp for chatting in service. ( android, ios app connect to server with stomp, and then send/receive stomp messages. ) when we deploy stomp web server, throws exception when server reloading. ( intermittently occurs after server reloading. )
"java.lang.IllegalStateException: No decoder for session id 'e3d585e7-f176-362b-2b7a-9dbf8630cc82'
at org.springframework.web.socket.messaging.StompSubProtocolHandler.handleMessageFromClient(StompSubProtocolHandler.java:231)
at org.springframework.web.socket.messaging.SubProtocolWebSocketHandler.handleMessage(SubProtocolWebSocketHandler.java:312)
at org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:75)
I heard that this exception occurs the connection is closed by the server and spring drops the session and everything(decoder) associated with it. This exception occurs in spring library. so we can't anything to prevent this exception occurs.
I want know about how can we prevent to occur this exception when server deployed.
I thought some cases about send to "DISCONNET" message client.
-
server send "DISCONNECT" message to client with regiseterd session id when server drops.
But in now, we don't know how can get connected session id in server. If we can get session id for all client connected in server, then we can do it. or if we can extend StompSubProtocolHandler and register custom StompSubProtocolHandler, then it can be done. -
catch IllegalStateException and send to "DISCONNET" message client.
This error occurs in library. If we register exception handler, then we seems to control it, but we can't know about session id in clent.