0

I'm new with socket.io and node.js but I love it and I have to solve a problem.

my scenario looks like the following:

S* = my Node.js Server
A* = my first webapp client
B* = my second webapp client

1) A* first contact S*, opens a connection and receives a "Unique Session ID"
2) B* wants to interact with A* through the "Unique Session ID", it opens a connection with S* and if the "Unique Session ID" exists, S* send a message to A*

It's very similar to a simple chat but I can't find the proper way (or a good tutorial) on how to forward/emit a message to a specific volatile recipient.

I think I found a trail in namespaces, rooms and #ID but how can I be sure about no one is spoofing the namespace and is listening at my message ??

Thx in advance to everyone!
A.

Endriu
  • 25
  • 1
  • 3

1 Answers1

0

May be think of :

  • Associating new connections with a unique token id (to differenciate connections coming from same IP)

  • Keeping a map associating these IDs to socket connections

  • Notifying players dis/connections IDs to other players already connected

Have a look at that : http://tamas.io/simple-chat-application-using-node-js-and-socket-io/

And turn on TLS on your server if you want a secure channel.

Frédéric Ménez
  • 1,802
  • 1
  • 11
  • 7