node.js - Sender of Socket.io message cant get messages like other users -


i want implement socket.io's room functionality , configuration this:

io.on('connection', function (socket) {     socket.join('123');     //... } 

and when want emit event:

socket.in('123').emit('sendmessage', {items:values]}); 

but gets message except sender of message. why? have emit() separate message sender?

if use socket.to('123') instead of socket.in('123') same result , nothing changes. use socket.io's official documents: http://socket.io/docs/rooms-and-namespaces/

to send including sender need use following syntax:

io.sockets.in('123').emit('message', 'cool game'); 

note using global io assume have included this:

var io = require('socket.io'); 

Comments