How to close PrimeFaces socket connection

2019-03-06 08:42发布

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条回答
不美不萌又怎样
2楼-- · 2019-03-06 09:07

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

查看更多
登录 后发表回答