How to close PrimeFaces socket connection

岁酱吖の 提交于 2019-12-20 06:01:10

问题


We’re using PrimeFaces 4.0 (socket) and atmosphere 2.0.3 for server side push in our J2E application.

The issue with application it doesn’t close socket after closing browser or logout from the application. Hence application produce a socket in CLOSE_WAIT status and ultimately it create too many open connections(1024) and it throw below error. Most of the connections on this port on CLOSE_WAIT status.

JBWEB003008: Maximum number of threads (1024) created for connector with address /0.0.0.0 and port XXX.

code snippet for socket in JSP

<p:socket id="s" channel="#{xxx.eventChannel}"
                onMessage="modelEventHandler.handleModelEvent" widgetVar="xxxSocket" transport="sse"  onClose=""/>

I’ve tried to close this by calling java script function on click of logout button but it doesn’t work.

function logOut() {
                PF(xxxSocket).disconnect();
            }

回答1:


You can try PF('chat-socket').disconnect();



来源:https://stackoverflow.com/questions/43628306/how-to-close-primefaces-socket-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!