-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebSocket: introduce a reliable way to detect "WebSocket is closed" error #5221
Comments
+1 |
@mkouba I think you can set a close handler on the WebSocket and be aware of when a WebSocket is closed and cannot send message anymore |
Yes, that's possible and we use it but for a different purpose. In this particular case, we need to react immediately, e.g. when |
we totally can do that, I was just pointing out that the common design we advocate is that you set a boolean closed that is set to true when the close handler is called and it can be probed |
I get it and as I already mentioned we use this pattern but it does not really help if you need to analyze a failure produced by |
Describe the feature
Currently, when the connection is closed but the client still attempts to write a message the API returns a failed
Future
where the cause is represented as aNoStackTraceThrowable
with messageWebSocket is closed
. Consequently, it's not possible to detect this kind of error in a reliable way.It might be useful to introduce either (A) a specific exception like
WebSocketClosedException
or (B) any other means, such as an error code (enum, constant, etc.) stored in the throwable/failed future.Use cases
In Quarkus, we would like to be able to catch this kind of error and react appropriately.
The text was updated successfully, but these errors were encountered: