Two Websockets on one Page

UI Components for JSF
Post Reply
TooR
Posts: 9
Joined: 13 May 2014, 10:01

23 Jul 2014, 16:39

Hello,

I am devloping an Application which is very Data-Driven. Therefore I like to get my View updated from the Database-Changes.
Now I try to open two Sockets with PrimeFacesPush but only one socket gets the event.

Here a small snippet for you.

Code: Select all

<h2>Pushtest</h2>
<h:outputLabel id="output1" value="#{someDataBean.data}"/><br/>
<h:outputLabel id="output2" value="#{otherDataBean.data}"/><br/>

	
<p:socket channel="/someData"  >
    <p:ajax event="message" update=":output1"/>
</p:socket>				
<p:socket channel="/otherData"  >
    <p:ajax event="message" update=":output2"/>
</p:socket>
The outputlabels receive their data from different Data-tables. Therefore I need two parallel open websockets. Can anyone tell me how get thing working?
PrimeFaces 5.1 | Primefaces-Extension 3.0.0 | Mojarra 2.2 | Atmosphere 2.2.4 | Tomcat 8.0.14

smithh032772
Posts: 6144
Joined: 10 Sep 2011, 21:10

23 Jul 2014, 23:32

Howard

PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome

Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

24 Jul 2014, 21:29

Two sockets on one pages work fine for me (even 3) on a normal PF5 setup on JBoss Wildfly 8. What version of Atmosphere are you using?

TooR
Posts: 9
Joined: 13 May 2014, 10:01

29 Jul 2014, 11:42

We are using Atmosphere 2.1.3
It works if i Configure Atmosphere to use Long-Polling.

Our solution was to rework the whole mechanism and using only one Websocket.
PrimeFaces 5.1 | Primefaces-Extension 3.0.0 | Mojarra 2.2 | Atmosphere 2.2.4 | Tomcat 8.0.14

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests