客户端脚本
var socket = io.connect();
var room = "abc123";
socket.on('connect', function() {
socket.emit('room', room);
});
socket.on('message', function(data) {
console.log('Incoming message:', data);
});
服务器端脚本
io = socketio.listen(server);
io.sockets.on('connection', function(socket) {
socket.on('room', function(room) {
socket.join(room);
});
});
room = "abc123";
io.sockets.in(room).emit('message', 'what is going on, party
people?');
我正在尝试将邮件发送到abc123,但是io.sockets.in无法正常工作