-
Notifications
You must be signed in to change notification settings - Fork 4
Description
After exiting the current running application gracefully by calling launcher.dispose() after a logout(), the handled exitcode 1000 on closing the websocket connection is never sent by the server code and the sent "DISPOSE" isn't implemented.
// WebSocketListener.java
/**
* {@inheritDoc}
*/
public void pushDispose()
{
session.getAsyncRemote().sendText("DISPOSE");
}
// ...
/**
* {@inheritDoc}
*/
public void close() throws Throwable
{
session.close(new CloseReason(CloseCodes.GOING_AWAY /* = 1001 */, null));
launcher = null;
session = null;
}The server just handles the 1000 exit code in AppProvider.tsx to stop the application:
// ...
ws.current.onclose = (event) => {
// Stop sending ping and alive on ws close
pingInterval.stop();
clearInterval(aliveInterval.current);
if (event.code === 1000) {
// no reconnect
wsIsConnected.current = false;
console.log("WebSocket has been closed.");
resolve();
}
// ...
}And because the reconnectInterval is currently not cleared, the websocket will try to reconnect to a closed session.
This way, the initially displayed "410 - Gone" message from the response will change to the "server is not reachable" message and restart the websocket connection.
Is there currently a other preferred way to close the application?
The EXIT request currently seems only be used in the development commands and also restarts the application.