Question

Has anyone succeed in using above configuration? I am trying to use push with growl from primefaces. I am using primefaces 3.5 GlassFish 4.0 and Atmosphere 2.0.0.RC5 My config is as follows:

<servlet>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>

The Bean method:

private void assaginTreatment()
  {
    ...
    PushContext pushContext = PushContextFactory.getDefault().getPushContext();
    pushContext.push("/notifications", facesMsg);
    return;
  }

And finally the xhtml file:

 <p:growl widgetVar="growl" showDetail="true" sticky="true" globalOnly="true" autoUpdate="true" />
            <p:socket onMessage="handleMessage" channel="/notifications" autoConnect="true"/>
            <script type="text/javascript">
                function handleMessage(facesmessage) {
                    facesmessage.severity = 'info';
                    PF('growl').show([facesmessage]);
                }
            </script>

The error I am getting is:

SEVERE: [http-listener-1(4)] WARN org.atmosphere.cpr.MetaBroadcaster - No Broadcaster match /notifications. Message...

Was it helpful?

Solution

Atmosphere-2.0.0.RC5, Primefaces-4.0.RC1

I managed to do a workaround which isnt nice really, but pushing to all, made it work. Might be enough for your usecase

pushContext.push("/*", facesMsg);

Edit: So i did some further debuging and added some more logging

if (BroadcasterFactory.getDefault() != null) {
    Collection<Broadcaster> list = BroadcasterFactory.getDefault().lookupAll();
    for (Broadcaster b : list) {
        logger.warn("id={}", b.getID() );
    }
}

output:

Info: 2013-09-17 22:43:10,010 - id=/*
Info: 2013-09-17 22:43:10,010 - id=/notificationsprimepush

so finally i tried:

pushContext.push("/notifications" + "primepush", facesMsg);

WORKED! :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top