quarkus-http
quarkus-http copied to clipboard
WebSocket: Support Servlets using Undertow
Original MyFaces issue: https://issues.apache.org/jira/projects/MYFACES/issues/MYFACES-4684
MyFaces allows users to do this...
<f:websocket scope="session" channel="pushChannel" onmessage="function(m){console.log(m);}">
<f:ajax event="quarkusMessage" render="frmSocket:txt_count"/>
</f:websocket>
A websocket can be associated to a particular USER or Session so only that session sees messages on that channel. This no longer works because here:
https://github.com/apache/myfaces/blob/1e369ebb8e569f5bbb08912e66dbb978c1d2483b/impl/src/main/java/org/apache/myfaces/push/WebsocketConfigurator.java#L48-L88
The value for HandshakeRequest request using request.getSession() is always NULL and thus breaks this code and websockets do not work.
what do you mean by a mock-session? It needs to be the same as the HttpSession, which is available during a JSF request.
cc @cescoffier
It won't have the semantic of the http session, it will be the same API with a very limited life span (the request). It's clearly a hack, there is no plan to support proper http session right now.
im not sure if this will work AFAIR we store some verification information in the HttpSession (currently SessionScoped bean), but we could switch to HttpSession#attributes
if both attributes are not the same, there is no benefit in itnroducing a short-living fake-session.
Maybe we need to check if the verification is required or at least deactivate it for quarkus environment.
Is there a plan to get this working again or should I try to find a different technology to achieve my goals? I am porting an application that was running on Wildfly using WS to notify the JSF front-end when certain things were updated.
@dstutz As a workaround....you can use OmniFaces Socket that works with Quarkus.
see: https://quarkus-faces-melloware-8a6a34c1.koyeb.app/ui/ajax/websocket.xhtml
@melloware ,nm.....got a replication of your example working. This stuff is black magic to get working. Thank you!
no problem yeah you have to follow the Omnifaces WebSockets instructions!