JSF session timeout and primefaces push -
i have session timeout set in web.xml
<session-config> <session-timeout>1</session-timeout> </session-config>
and track down implementation of httpsessionlistener. tested , see creation , destroying of each session - work fine.
but, after adding push services in app, etc:
xhtml:
<p:socket channel="/chat-notif"> <p:ajax event="message" global="false" update="label-chat-new-msg :f_chat_list :form-chat-conversation" /> </p:socket>
bean:
eventbus eventbus = eventbusfactory.getdefault().eventbus(); eventbus.publish(push_chat__message, "new-msg");
resource:
@pushendpoint(chatcontroller.push_chat_message) public class chatmessageresource { @onmessage(encoders = { jsonencoder.class }) public string onmessage(string finis) { return finis; } }
session has never timeout, since push on periodic interval communicate client page , update session idle timer, when user has no interaction on page.
how should avoid updating session lastaccessedtime on push messages?
pf 5.0, mojarra 2.2.5
thanks!
found reason updating session timers: on each push message, ajax triggering backingbean method - why session lastaccessedtime updated. change pure client side coding push services:
<p:socket onmessage="handlechatnotif" channel="/chat-notif" /> <script type="text/javascript"> function handlechatnotif(data) { $('.displaychatnotif').html(data); } </script> <h:outputtext styleclass="displaychatnotif" id="label-chat-new-msg" value="#{chatcontroller.chatnotifications}" />
now happens on client side , no request send web server, session timeout expired regulary.
Comments
Post a Comment