Atmosphere push question

UI Components for JSF
Post Reply
rabiter
Posts: 12
Joined: 11 Nov 2014, 13:24

14 Nov 2014, 17:21

Hello friends,

I'm going to try out the Primefaces Push mechanism (that is in turn based on Atmosphere) and I have got a small question. I mentioned that the Primefaces Push works rather like a broadcaster that can work with several channels. All clients (browsers) subscribed to a certain channel will receive the message from the server broadcasted to an appropreate channel.

Set the connection and subscribe to a channel:

Code: Select all

<p:socket onMessage="doFancyWorkOnMessage" channel="/myChannel" />
Broadcast a message by Server:

Code: Select all

EventBusFactory.getDefault().eventBus().publish("/myChannel", "hi there");
Am I right that ALL clients who subscribed to the /myChannel will receive the "hi there" message?
What if I want to send a message from Server to a browser with a certain http session? Do I have use separate channel ("private" channel) for each session or is there another way to do it?

Kind regards ant thanks!

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

17 Nov 2014, 23:06

please study the PrimeFaces Push CHAT showcase xhtml and source code. that will answer your question.
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

rabiter
Posts: 12
Joined: 11 Nov 2014, 13:24

19 Nov 2014, 15:10

smithh032772 wrote:please study the PrimeFaces Push CHAT showcase xhtml and source code. that will answer your question.
Thank you! It helped.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 9 guests