Primefaces socket can't receive message from Primefaces push

UI Components for JSF
Post Reply
zxret153224
Posts: 1
Joined: 09 Jul 2014, 16:06

09 Jul 2014, 16:09

In a JSF facelet, I define a p:socket component to receive the message returned from PushEndPoint.

When the JSF facelet is displayed in a web browser, the p:socket component can receive the pushed message.

However, when the JSF facelet is not displayed, the p:socket component just misses the push message, which is normal because p:socket is not rendered.

I am wondering if there is a way to make the pushed message 'waiting' somewhere, when next time the JSF facelet is displayed, p:socket can receive the 'waiting' message.

Many thanks.

Cheers.

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

10 Jul 2014, 21:48

why don't you cache all messages in a 'list', and add some xhtml/javascript/remotecommand that will send a message to the server from client/browser that client has received MessageXXX. on server, when server receives message from client that messageXXX was received, then server can delete MessageXXX from cache/list.

whenever you 'add' a new message to cache, you may want to resend any non-received messages to client, or you can add some other type of polling on server or client to send messages from cache.

maybe you should use p:poll instead of p:socket.

EDIT:

See Ronald's answer in the forum topic below,

Message is not delivered if user navigates between pages
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

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 27 guests