node.js - Socket.io 1.4.5 Rooms issue -
i unable emit events rooms in server application, using version 1.4.5
i tried these 2 ways communicate in room, neither worked.
this.io.to(this.id).emit(eventname,data); this.io.sockets.in(this.id).emit(eventname,data); before calling this, register user in room in fashion
user.socket.join(this.id); further details
the
this.ioobjectrequire('socket.io')(http);the
user.socketobjectio.on('connection', function(socket)
i omitted rest of code because in overly complex structure , inheritance chain, , irellevant question.
i dont require code snippet copy, rather way how debug , figure issue out.
edit
when pause application @ moment when want emit message, when inspect io object, following.
io -> nsps -> '/' -> adapter -> rooms -> theroomname -> sockets and socket id is listed there.
is there way how find out whether message being sent ?
edit #2
when inspect socket object, located @
io -> sockets -> sockets -> "socket id" -> rooms the room id is present there well
making comment answer per request:
the first 4 things confirm are:
- what value of
this.io, supposed be? - what value of
this.id, supposed be? - what
eventname? - is client listening
eventnamemessage?
also, can use server debugger trace .emit() , see intending send message.
then, can use network trace on server wireshark or ethereal verify server sending message out.
then, can use network tab in chrome debugger see if message arriving browser page.
postscript: sounds item 4 above problem was.
Comments
Post a Comment