0

I want to send message to specific socket. I used below code for this but it's not working and also not getting any error.

io.to(socketid).emit("message_to_client",{"message":data.message});

Please let me know anything wrong in this.

Any help Appreciated!!

Vipin
  • 847
  • 1
  • 10
  • 21

1 Answers1

-1

You should do this instead because parameter's name aren't string :

io.to(socketid).emit("message_to_client",{message : data.message});

http://www.w3schools.com/js/js_objects.asp

Blizardfx
  • 1
  • 2
  • A property name can be quoted as a string just fine. It does not need to be quoted if it has no Javascript reserved characters in it, but with quotes will always work. This not a solution to the OP's issue. For your own info, w3schools is not considered a very thorough reference source by many. – jfriend00 Dec 30 '15 at 20:47