-
1. Re: event.rf.data is undefined when pushing with onsubscribed event
andreig Oct 16, 2012 1:30 AM (in response to andreig)After a few more tests I noticed that atmosphere framework is started after the push is done. I've tried to load AtmosphereServlet at the start of the application. I have a login page. Atmosphere framework is started before the login page is rendered. After an user successfuly logs in the atmosphere framework starts again. Is this the normal behaviour?
-
2. Re: event.rf.data is undefined when pushing with onsubscribed event
andreig Oct 30, 2012 5:58 AM (in response to andreig)I've manage to start Atmosphere framework only once. If you want start it at the application start up you have to add this to your web.xml file under <web-app> tag.
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.PushServlet</servlet-class>
<load-on-startup>3</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/__richfaces_push</url-pattern>
</servlet-mapping>
<!-- setups servlet-mapping in RichFaces configuration -->
<context-param>
<param-name>org.richfaces.push.handlerMapping</param-name>
<param-value>/__richfaces_push</param-value>
</context-param>
My mistake was that I was loading AtmopshereServlet at start up instead of PushServlet. So I was ending having 2 instance of AtmosphereServlet.
Anyway this doesn't solve my initial problem. Looks like "onsubscribe" event can be used only to render components on client. event.rf.data is not yet defined. If you don't want to lose any event.rf.data then you have to make sure that client has subscribed to that address before sending any data.