'net'拒绝排放'关闭'nodejs中的事件
'net' refuses to emit 'close' event in nodejs
hi我有以下代码:
this.stop = function() {
this.server.close();
var thisServer = this;
this.server.on('close',function() {
thisServer.emit('stop');
});
};
在使用服务器并调用停止函数后,服务器拒绝发出"关闭"事件和
this.server.on('close',function() {
thisServer.emit('stop');
});
我做错什么了吗?
this.server.on('close',function() {
thisServer.emit('stop');
});
this.server.close();
var thisServer = this;
在调用关闭之前绑定关闭事件。
或者尝试this.server.destroy();
相关文章:
- NodeJS-readline暂停和恢复事件发射器(逐行读取)
- 在Nodejs中堆叠异步回调事件的最佳方式
- 在NodeJS中使用类函数作为事件侦听器
- 通过进程使用 NodeJS 全局事件是个好主意吗?
- Nodejs事件多次触发
- NodeJS中的事件,事件正在setInterval内发出,但不能没有setInterval
- nodeJS 等待无法承诺的事件
- 是否可以在 NodeJS 中模拟键盘/鼠标事件
- 当事件发生时调用nodejs中的函数
- NodeJS&Socket.IO:发出请求事件并获取响应,我应该在何时/何地绑定侦听器
- 如何在 nodejs 中维护事件循环中的持久数据
- NodeJS如何将onchange事件添加到字符串中
- 使用 on nodejs 从另一个模块捕获事件
- NodeJS + SocketIO 大套接字事件管理
- “事件发射器内存泄漏”发生,尽管使用了最新版本的nodejs
- 具有多个“数据”事件处理程序和竞争条件的 NodeJS 流
- Nodejs正在侦听来自http.get()的数据事件的响应流
- 在nodejs express模块中处理所有事件之前发送响应
- 服务器关闭时触发事件(NodeJS)
- RxJS对已发出的事件nodejs进行分组