如何关闭 PrimeFaces 套接字连接 [英] How to close PrimeFaces socket connection

查看:75
本文介绍了如何关闭 PrimeFaces 套接字连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 J2E 应用程序中使用 PrimeFaces 4.0(套接字)和大气 2.0.3 进行服务器端推送.

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

应用程序在关闭浏览器或从应用程序注销后不关闭套接字的问题.因此,应用程序在 CLOSE_WAIT 状态下生成一个套接字,最终它创建了太多打开的连接 (1024) 并抛出以下错误.此端口上的大部分连接处于 CLOSE_WAIT 状态.

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:为地址为/0.0.0.0 和端口 XXX 的连接器创建的最大线程数 (1024).

JSP 中套接字的代码片段

code snippet for socket in JSP

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

我试图通过单击注销按钮调用 java 脚本函数来关闭它,但它不起作用.

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();
            }

推荐答案

你可以试试PF('chat-socket').disconnect();

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

这篇关于如何关闭 PrimeFaces 套接字连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆