-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Jetty 12 - Rewrite of the Jetty WebSocket APIs #9552
Comments
See also #9550 for an explanation of why the undefined semantic of the APIs, coupled with blocking APIs, causes certain scenarios to lockup. Would be great if |
@gregw @lachlan-roberts @lorban @joakime your thoughts? |
hey @sbordet I would like to work on this issue. As I am a beginner I would appreciate your guidance. thank you. |
@monish-byte this issue is not something you could help with. If you want to contribute look at open issues with the "Help Wanted" tag. |
@sbordet I think all of those points are just because the Jetty API is designed to mirror what the Jakarta WebSocket API is doing. But I think if we decide to move away from that style now would be a good time. I would suggest that we preserve the old Jetty WebSocket API for EE8/EE9 and then have a new WebSocket API in jetty-core which is extended in EE10 to give access to the servlet behaviours. |
* Removed unnecessary classes, among which BatchMode, CloseStatus, etc. * Coalesced all listener interfaces into Session.Listener. * Moved RemoteEndpoint functionality to Session. * Renamed WebSocketPolicy to Configurable. * Renamed WriteCallback to just Callback, as it is now also used for some listener methods. Signed-off-by: Simone Bordet <[email protected]>
* Removed unnecessary classes, among which `BatchMode`, `CloseStatus`, etc. * Coalesced all listener interfaces into `Session.Listener`. * Moved `RemoteEndpoint` functionality to `Session`. * Renamed `WebSocketPolicy` to `Configurable`. * Renamed `WriteCallback` to just `Callback`, as it is now also used for some listener methods. * Renamed `@OnWebSocketConnect` to `@OnWebSocketOpen` * Renamed `Session.Listener.onWebSocketConnect()` to `onWebSocketOpen()`. * Removed `@WebSocket` annotation attributes, because they were just a subset of the configurable ones and they can be configured directly on the Session instance. * Removed `Session.suspend()` and `SuspendToken`, and introduced `Session.demand()`. * Introduced `@WebSocket.autoDemand` and `Session.Listener.AutoDemanding` to support automatic demand upon exit of WebSocket handler methods. * Removed `FrameHandler.isAutoDemanding()` and `CoreSession.isAutoDemanding()`. * Changed the responsibility of demand from `WebSocketCoreSession` to `FrameHandler`, which in turn may delegate to `MessageSink`. * Updated MessageInputStream to fail if an exception is thrown by the application. Signed-off-by: Simone Bordet <[email protected]>
Fixed by #9652. |
Jetty version(s)
12+
Enhancement Description
The Jetty WebSocket APIs were designed following a similar design of the Jakarta WebSocket APIs.
However, that design is old and it clashes with other Jetty core APIs that we have.
In particular:
Session.getRemote()
WebSocket[Connection|Frame|Partial|PingPong]Listener
) has unclear semantic wrt threading. In particular, can an event handler method perform blocking calls?Not to mention the number of interfaces for the various events that may not be optimal when it comes to
instanceof
checks (see https://bugs.openjdk.org/browse/JDK-8180450).Session.suspend()
to try to cope with it.This clashes with all the other Jetty 12 APIs that have explicit demand APIs.
Reader
orInputStream
that the implementation treats specially wrt threading: since they offer blocking APIs, there is no demand because the event handler method is not exited, so the implementation has to demand internally in order to feed theReader
orInputStream
.This would be the right time to re-design the APIs to align them with the rest of the Jetty 12 APIs.
The text was updated successfully, but these errors were encountered: