这可能是明显的,但我不明白为什么我没有在服务器端收到我的活动
服务器:
io.sockets.on('connection', function (socket, pseudo) {
socket.on('clickOnGraph', function(){
console.log('Reception of the first sending');
socket.broadcast.emit('clickOnGraph')
console.log('Broadcasting to everyone');
});
客户:
$scope.clickOnGraph = function(){
console.log('click detected, first sending to server');
socket.emit('clickOnGraph');
}
socket.on('clickOnGraph', function(){
console.log('Reception of the broadcast');
console.log('Event clickOnGraph : OK');
});
当我从服务器向客户端发送事件时,它可以工作,但不是相反的...... 并且$ scope.clickOnGraph正在运行。
谢谢你的帮助,我疯狂了