Sunday, June 7, 2009

Server Sided PubSub via Node.js

A couple days ago ry released the very exciting JavaScript web server Node.js which is purely built on event-based IO using v8 (Btw: Did anyone notice that this blog is now hosted under the domain :).
From a JS perspective this means building scalable comet application is as easy as not sending a response immediately but rather doing that in a callback function whenever an event might happen. As long as there is only a single node, writing an event queue is also easy. Just use an object that maps queue-ids to listeners.
To give Node.js a try I ported the work I did to allow servers to subscribe to custom events on the client. It turned out to be really straight forward. Here is the result.
Post a Comment