<p:socket> "autoConnect" option

UI Components for JSF
Post Reply
wschmitz
Posts: 29
Joined: 13 Dec 2012, 23:50

18 Aug 2014, 15:45

I have the "autoConnect" option set to true on <p:socket> and it is placed in the template of my application. I am implementing a push notification feature, similar to chat, where as soon as the user logs into the app, Administrators can send them push notifications.

My question is whether setting autoConnect="true" is safe to do in the template - this will get evaluated on every page turn. Will it try to connect on every page turn? Will it cause issues or is it bad practice?

Thanks.
Using Primefaces 5.0.9, Primefaces Ext 2.1.0, MyFaces JSF 2.2.0, Tomcat 7.0.54

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

18 Aug 2014, 18:04

wschmitz wrote:I have the "autoConnect" option set to true on <p:socket> and it is placed in the template of my application. I am implementing a push notification feature, similar to chat, where as soon as the user logs into the app, Administrators can send them push notifications.
autoConnect=true is default. please see PrimeFaces user guide and p:socket details.
wschmitz wrote:My question is whether setting autoConnect="true" is safe to do in the template - this will get evaluated on every page turn. Will it try to connect on every page turn? Will it cause issues or is it bad practice?
Yes, it is safe, and yes it will try to connect on every non-AJAX page request. That is what it does in my app, and I have many non-AJAX page requests, and it does a new connection on every non-AJAX page request. That causes no issues in my app.
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: jaircalistrato and 59 guests