Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] WebSocketConnectionListener guarantees

This is correct, onWebSocketClose will always be called.

This may be called for various reasons though
1. a close frame is received but one has not been sent you may send a close frame from this method.
2. otherwise you may have already initiated the close handshake and you are receiving the response close frame which completes the close handshake
3. the connection was closed without a close frame (onError may be called directly before this with the Throwable error) and the status code could be 1006 (NO_CLOSE).

On Tue, May 7, 2024 at 8:39 AM James Reeves via jetty-users <jetty-users@xxxxxxxxxxx> wrote:
Hi folks,

On the org.eclipse.jetty.websocket.api.WebSocketConnectionListener interface, can I assume that if onWebSocketConnect is called, indicating a successful connection, then onWebSocketClose will be called at some point in future, even if the connection closes without a valid close frame?

In other words, can onWebSocketClose be used to clean up resources established in onWebSocketConnect (assuming the process has not been terminated)?

--
James Reeves


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users

Back to the top