On Fri, Sep 5, 2014 at 3:05 PM, Felipe Jaekel <[email protected]> wrote:

> I thought so too, but it doesn't. From what I read today in the atmosphere
> group, the native runtime is only required for "old" non-standard
> websockets implementations, so I'll give atmosphere-runtime another try.
>

okay/interesting.


>
> I think the server crash happened because the PrimeFaces socket
> component doesn't validates the user browser, and I had a lot of clients
> with
> old IE. Currently I only render the socket component with the client
> browser supports websocket.
>

okay/interesting.


>
> Could you share your PrimeFaces socket component configuration?
>

        <h:outputScript library="primefaces" name="push/push.js"
target="head" />
        <p:growl id="pushedNotifications" for="socketForNotifications"
                 widgetVar="growl" globalOnly="false"
                 life="30000" showDetail="true" showSummary="true"
escape="false"/>
        <p:socket id="socketForNotifications"
onMessage="handlePushedMessage"
                  widgetVar="socket"
                  channel="/#{pf_usersController.userPushChannelId}" />


userPushChannelId = sessionId (see code below)

        FacesContext facesContext = FacesContext.getCurrentInstance();
        HttpSession httpSession = (HttpSession)
facesContext.getExternalContext().getSession(false);
        String sessionId;
        if (httpSession != null) {
            sessionId = user.getUserName() + httpSession.getId();
        }
        else {
            sessionId = user.getUserName() +
                        new
DateTime(user.getLastLoginDt()).toString("yyyyMMddhhmmssa");
        }
        logger.info("sessionId = " + sessionId);


NotifyResource.java (as required by PrimeFaces 5.0 Push, and sample code
provided by PrimeFaces Push - Notify example in showcase and user guide)

package pf;

import javax.faces.application.FacesMessage;
import org.primefaces.push.annotation.OnMessage;
import org.primefaces.push.annotation.PushEndpoint;
import org.primefaces.push.annotation.Singleton;
import org.primefaces.push.impl.JSONEncoder;

@PushEndpoint("/{usernameAndSessionId}")
@Singleton
public class NotifyResource {

    @OnMessage(encoders = {JSONEncoder.class})
    public FacesMessage onMessage(FacesMessage message) {
        return message;
    }

}


again, my web.xml is as follows:


    <servlet>
        <servlet-name>Push Servlet</servlet-name>
        <servlet-class>org.primefaces.push.PushServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <init-param>

<param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>

<param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
        </init-param>
        <async-supported>true</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Push Servlet</servlet-name>
        <url-pattern>/primepush/*</url-pattern>
    </servlet-mapping>


FYI, my webapp only targets Google Chrome browser on Windows desktops, iPad
and Android devices.

Reply via email to