Monday, June 15, 2009

Scalable PubSub with Node.js

I made some extentions to my server sided pub sub implementation based on Node.js.

When a client establishes a comet connections to listen for events published by the server it in turn receives the internal URL of the Node that it it attached to.
Now when the client publishes an event to any server (or actually a different node process running on a particular machine) and the server in turn publishes an event to client, the node that received the event relays the response to the correct Node via that URL which then uses the open comet connection to send the message to the client.

Overall this implements a solution to do PubSub between client and server without the need for stateful load balancing.

Here is the changeset for the interested.

No comments: