Code: Select all
<h:form id="pollForm">
<prime:poll id="poll" interval="5" listener="#{myBean.updateAll}" async="true"/>
</h:form>
The updateAll method updates data for desired components in separate threads. Each of those updates may take varying amounts of time, some taking over the poll interval of 5 seconds.
Now if I specify the "update" attribute for poll, the components are not updated until a poll request gets a 200OK response, which may take longer than the poll interval if any of the update threads takes longer (I guess this is the expected behavior).
To make the updates more dynamic, I tried using PrimeFaces push to send a notification to update the components as soon as an update thread finishes. The markup for the corresponding socket looks like this:
Code: Select all
<h:form id="socketForm">
<prime:socket id="myBeanSocket" channel="/myBean">
<prime:ajax event="message" update=":myBeanForm:myComponent"/>
</prime:socket>
</h:form>
Any thoughts on why the updates could be delayed, even when using push?
Is there a recommendation on how to do periodic polling to update multiple components on single page?
Also I notice that PrimeFaces push with Sockets doesn't seem to work well when more than one socket is placed on a single page?
Environment:
Glassfish: 4.1
PrimeFaces: 6.1
Atmosphere runtime: 2.4.9
JSF API (javax.faces-api): 2.2