0

In my application I have a global state, which I distribute to different nodes on different servers through membase.

The nodes themselves have clients who need to be informed when the global state has been changed, but the only way I see is to poll the state from membase and send it to the client when changed. So I only have traffic between client and server when a change has happend, but I would have a constant traffic between the server and membase, which is not in the sens of the non-blocking IO of node.

Is there a better way?

K..
  • 4,044
  • 6
  • 40
  • 85

1 Answers1

0

Best way to achieve this is by taking advantage of Redis's pub-sub feature. You use a channel to send messages and all your nodes are connected to that channel. When a new message is received, all nodes can react.

Read more about Redis's pub-sub feature with Node:

http://howtonode.org/redis-pubsub
Pub/sub implementation in nodeJS
http://laktek.com/2010/05/25/real-time-collaborative-editing-with-websockets-node-js-redis/

Community
  • 1
  • 1
alessioalex
  • 62,577
  • 16
  • 155
  • 122