io.sockets.on('connection’,function(client){ client.broadcast.send({message: client.sessionId + 'is now available’});
client.on('message', function(msg) { client.broadcast({ message: client.sessionId + ': ' + msg.message }); });
client.on('disconnect', function() { client.broadcast({ message: client.sessionId + ' is no longer available'}); });
});
我上面这种广告好像不行 我把 client.broadcast 变为 client.broadcast.emit(); 好像也还是不行 我前端是这样接收的 socket.on('message’, function(message){ } 接收不到广播
哪位兄长,有没有nodejs和客户端通信的文档或者DEMO,非websocket哦