NOTiFY
NOTiFY

Reputation: 1403

JSF 2.3 & o:socket or f:websocket - Nothing 'pushed' to the client

After help from @BalusC I have my EJB method firing an event on JBoss WildFly 12.0.0.Final (MacOS) using JSF 2.3 running on EE8:

beanManager.fireEvent("updateNotifications" );

the POJO:

@Inject
@Push(channel = "testChannel")
private PushContext pushContext;

public void onPersist(@Observes String notification) {
    logger.info("***** onPersist notification = {}", notification);
    pushContext.send("updateNotifications");
}

receives & prints the message;

16:03:36,682 INFO [com.notifywell.ejb.FoodsCosmeticsMedicinesEJB] (default task-3) >>>>> insertFoodsCosmeticsMedicinesEJB beanManager = Weld BeanManager for NOTiFYwell.ear/NOTiFYwellJAR.jar/ [bean count=39]

16:03:36,695 INFO [com.notifywell.push.PushBean] (default task-3) ***** onPersist notification = updateNotifications

I can’t get it to communicate with XHTML from the Push Send. I’ve tried with both OmniFaces 3.1 & the JBoss WildFly 12 JSF 2.3 and nothing re-renders (XHTML code not shown here). When using OmniFaces 3.1 I can’t get the onmessage to display:

<h:form>
    <o:socket channel="testChannel" onmessage="socketListener"/>
    <h:outputScript>
        function socketListener(message, channel, event) {
            console.log(message);
        }
    </h:outputScript>
</h:form>

If I open the console log in Chrome it's empty there's no “message”.

In WireShark I see:

2601 9.810264 ::1 ::1 HTTP 997 GET /NOTiFYwell/omnifaces.push/testChannel?a1ef3363-dc5a-4153-a4c7-73b0e183713d HTTP/1.1

It is as though the

pushContext.send(notification);

is not getting executed.

Upvotes: 1

Views: 1332

Answers (1)

Meini
Meini

Reputation: 77

I had exactly the same Situation with Wildfly 14.

To resolve this i had to:

  1. undeploy the Application
  2. shutdown the Server
  3. clear the content of the tmp folder in standalone
  4. start server
  5. deploy

Now it works, but if I deploy without steps 1-4 it wont work again. (Maybe Step 3 is not necessary, but i do it because i got so many other errors)

Upvotes: 1

Related Questions