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.io object require('socket.io')(http);

  • the user.socket object io.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:

  1. what value of this.io , supposed be?
  2. what value of this.id , supposed be?
  3. what eventname?
  4. is client listening eventname message?

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

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -