What is the best way to make one node.js server "talk" to another?

  • Msgpack?
  • JSON-RPC?
  • Socket.io (is this possible?)?

EDIT: I'm talking about 2 node processes each of them on a different physical machine;

I do not understand how redis can help me with this ...

+7
source share
3 answers

I don’t quite understand if you are looking for ways to make two node servers on two physical machines “talk to each other” or two node.js server processes on the same machine.
(You can edit your question to make it more understandable).

You can watch:

Note. Some may require some updating.

I hope this helps

+7
source

I would go for redis . The semantics of the pubsub are pretty sweet. The node_redis client library runs very quickly since it can use the rapidly expanding c-extension library called hiredis. I would just use json for coding. It will probably be more than fast enough.

You can also use DNode to make your message if you want. I also believe that it has socket.io features. You must look at the source code to find out.

+3
source

From your question it is not clear what you mean by a Node server talking to another server. You can use anything: from sending UDP packets, TCP connections, HTTP connections to using any of the high-level mechanisms that others have already indicated.

For an interesting look at Node communication processes, you can take a look at the 2010 report at JSConf.eu from Mikeal Rogers . He explains how to use CouchDB for this. Very interesting conversation.

+1
source

All Articles