-
Notifications
You must be signed in to change notification settings - Fork 56
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
Support websocket based server push with CDI #88
Comments
Originally by @Legioth What is the exception thrown by the first button? I suspect the problem is that the JEE context is not properly initialized by the servlet container when handling push messages, i.e. that this is caused by http://dev.vaadin.com/ticket/12480. |
Originally by @peholmst SEVERE: com.vaadin.server.ServerRpcManager$RpcInvocationException: Unable to invoke method click in com.vaadin.shared.ui.button.ButtonServerRpc |
Originally by @peholmst On a side note, when implemented in Spring, the exception is that no request has been bound to the currently executing thread. |
Originally by @Artur- Need to investigate this for the next CDI version. Possibly requires session access events (#12256). |
Originally by LukaszByczynski Above example works with Glassfish 4 and vaadin-cdi-snapshot. Maybe that issue is related to weld container and his proxies for session beans? |
Originally by @Legioth Replying to LukaszByczynski:
This most likely because the Atmosphere version used in Vaadin 7.1 does not support WebSockets in GlassFish 4. See #12120 for the details about this. |
Originally by proaccountapp Updated prioritization date. |
Originally by @Saulis This needs some design work and will be implemented in CDI 1.0. |
Originally by @Artur- This is really an issue in the CDI and/or websocket specs because they don't take each other into account. Hopefully this will be resolved in a future version of the spec. Can't really classify this as a bug in Vaadin CDI. We might be able to implement something to get around this for Vaadin CDI 1.0.0 by manually initializing CDI, not 100% sure it is even possible. Until then you should use long-polling if you need CDI support. References: |
Originally by proaccountapp Removed prioritization date. |
Originally by @hesara Known CDI issues with push (including with web sockets) have been resolved. Note that this only concerns @UIScoped and @ViewScoped beans - request and session scopes are not supported with web sockets in CDI 1.0. If there are still specific issues, please create new tickets for each issue. See also #12996 about CDI and background threads. |
Note that you can use |
For us the solution was to use transport type WEBSOCKET_XHR. This still gives you the benefits of actual push from server to client through websocket, and uses standard XmlHttpRequest for client to server, so you get all the stuff that goes along with it including the active session context. |
@mpittkin, do you use |
Plain old @SessionScoped. We need the session sometimes in the service layer like
newPO.setCreatedBy(session.getLoggedInUser());
And we don’t have vaadin on the class path for the service layer.
Jun 30, 2018, at 3:51 AM, Mart Sõmermaa <notifications@github.com> wrote:
…
@mpittkin, did you use @VaadinSessionScoped or plain @SessionScoped with WEBSOCKET_XHR?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Perfect, that's exactly what I'm looking for. Case closed, thanks for sharing :)! |
Originally by @peholmst
When using Vaadin CDI together with server push (web sockets), you cannot access any session scoped beans from any Vaadin event listeners without getting an exception. The reason is most likely that all requests are done asynchronously when web sockets push is enabled, which in turn means that there is no session info bound to the thread that actually executes them.
Take this as an example:
The
UserInfo
bean is session scoped. A click on the first button will cause an exception, a click on the second button will work as expected. If the@Push
annotation is removed, both buttons will work as expected.I consider this a major issue since session scoped beans is a powerful way of sharing session date between Vaadin UI instances. I tested it on GlassFish 3.1.2.2 with websockets turned on and the grizzly fix installed.
I don't know if this has anything to do with #12021. This problem is also present in Spring, btw.
Imported from https://dev.vaadin.com/ issue #12464
The text was updated successfully, but these errors were encountered: