gpt4 book ai didi

node.js - Nodejs,如何检测关闭的套接字?

转载 作者:太空宇宙 更新时间:2023-11-04 02:36:03 25 4
gpt4 key购买 nike

nodejs 中的网络(TCP)套接字上存在 END 事件,但当它应该运行时没有任何反应:

socket.on('end', function(){
clients.splice(clients.indexOf(socket), 1);
console.log(socket.name + " left the chat.\n");
});

我读到存在 allowHalfOpen = true 属性。任何人都可以解释一下allowHalfOpen 做什么,以及如何让这个函数检测到任何断开连接,即使窗口已关闭。

附注如果这有区别的话,我会用 FLASH 制作应用程序。

最佳答案

尝试使用socket.on('disconnect')

关于node.js - Nodejs,如何检测关闭的套接字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22260381/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com