I utilize Jetty (9.4.1) websocket for 2 ways communication between client and server.
- On Client side, the messages 'onerror' and 'onclose' of WebSocket are listened, so that when there is a problem, the client will make a new connection.
- On Server side, the 'OnError' and 'OnClose' messages also handled.
Then, sometimes I see server got an 'org.eclipse.jetty.io.EofException', 'OnError' and 'OnClose' of ServerEndpoint are invoked. But on the Client side, there is no 'onerror' or 'onclose' message is sent.
Therefore, in this case the Client is not aware of the websocket connection is closed already, still use that connection.
My questions are:
1. How can this EofException happen?
2. When this error happen, is the connection actually close or still open? Because I cannot duplicate this error programmatically, I cannot investigate to understand clearly.
3. How can I make Client aware of this exception, so that Client can reconnect and function properly?