Since PrimeFaces have deprecated Push I'm trying to get JSF 2.3 working om GlassFish 5. I'm having trouble firing my listener though.
I have the following code:
@Inject
@Push(channel = "notifyjsf")
private PushContext push;
push.send("price");
logger.log(Level.INFO, "price push");
My problem is firing my notify function. If I set onmessage as follows it doesn't fire at all:
<f:websocket channel="notifyjsf" onmessage="notifyListener" />
Also I get a warning from IntelliJ that "Expression statement is not assignment or call"
However, if I do this:
<f:websocket channel="notifyjsf" onmessage="notifyListener(message,channel,event)" />
The listener is fired but I get an error:
"VM36:1 Uncaught ReferenceError: message is not defined
at eval (eval at <anonymous> (jquery.js.xhtml?ln=primefaces&v=6.1:14), <anonymous>:1:172)
My listener code is below
function notifyListener(message, channel, event) {
console.log("notifyListener message: " + message);
console.log("notifyListener channel: " + channel);
console.log("notifyListener event: " + event);
console.log("stocks: notifyListener");
}
Thanks, Zobbo