Javascript socket.io对象没有方法';发射';
我收到了这个错误消息 TypeError:对象[Object]没有方法“emit” 尝试访问由Javascript socket.io对象没有方法';发射';,javascript,node.js,socket.io,Javascript,Node.js,Socket.io,我收到了这个错误消息 TypeError:对象[Object]没有方法“emit” 尝试访问由helpQue.push(socket)构成的helpQue中的套接字时 helpQue和cxsQue都是套接字数组 setInterval(function() { if(helpQue.length > 0 && cxsQue.length > 0) { var id = makeid(), helpee = helpQue
helpQue.push(socket)
构成的helpQue
中的套接字时
helpQue
和cxsQue
都是套接字数组
setInterval(function() {
if(helpQue.length > 0 && cxsQue.length > 0) {
var id = makeid(),
helpee = helpQue.splice(0, 1);
helpee.emit('server-output', 'Test'); //ERROR here
}
}, 1000);
我把密码换成了
setInterval(function() {
if(helpQue.length > 0 && cxsQue.length > 0) {
var id = makeid(),
helpee = helpQue[0];
helpQue.splice(0, 1);
helpee.emit('server-output', 'Test');
}
}, 1000);
成功了。我想是splice
出了什么问题,但不知道是什么。如果有人知道,请告诉我