node-shoutbox - a simple node.js demo
Dave had shown me node-comment and I also studied node_chat. From there I had just enough reference material to understand the mechanics of long-polling and to start piecing together a simple real-time commenting system.
What is node?
In and of itself, node is not a web development stack. It provides an I/O platform of which HTTP handling is a part. People are building blogging and wiki engines, FTP servers and command-line tools with this thing, anything I/O based is possible and thankfully micro-frameworks like (fab) can ease the pain of creating web apps.
Node is still very young software, which I have felt the pain of. To serve up static content I wanted to use paperboy as it can be used as middleware within (fab), however mere days after the last update to the project the API it was relying upon in node changed fundamentally. Despite being new to node development I was able to patch paperboy to work with node v0.1.31 and get on with my actual project. Another sticking point was the inability of (fab) to handle POSTed form variables, this functionality is planned for it’s next release though.
When I had the basics of the app laid-down I eagerly awaiting the moment when I could have it open in two browser windows and enter a comment into one and see it appear in the second. That moment came and it brought a smile to my face. I suggest you give it a go :)
Get the code
As a wise man once said, code speaks louder than words, so please be my guest and clone my demo on GitHub.