我使用exBuffer进行的socket数据分包
var exBuffer = new ExBuffer();
exBuffer.on('data', function(data){
// do code
})
socketCli.on('data', function(data) {
exBuffer.put(data);
});
在大并发量下,现在会报错
(node) warning: possible EventEmitter memory leak detected. 31 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at Socket.EventEmitter.addListener (events.js:175:15)
at client.connection (/data/node/online/client.js:57:23)
at EventEmitter.emit (events.js:96:17)
at proc (/data/node/node_modules/ExBuffer/ExBuffer.js:151:26)
at put (/data/node/node_modules/ExBuffer/ExBuffer.js:100:9)
at Socket.client.connection (/data/node/client.js:96:22)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:396:14)
使用的nodejs的NET建立socket,socket监听到的消息全部交给exBuffer处理进行分包,解决之前出现的粘包问题。 但是现在会报错,提示监听数量达到了最大值,最开始提示10,我设置为30后,现在又开始报错。