14
Mar 11

nodechat achieves glorious internet notoriety

Two weeks ago, I released a tutorial on using node.js, backbone.js, socket.io, and redis to make a simple realtime chat app. Someone posted it to Hacker News and it made it the front page. fzysqr.com enjoyed brief fame and notoriety. The number one complaint (other than my awesome user interface) was that there was no demo. So without thinking (at all) I threw the code up on a Joyent no.de (Joyent are a bunch of node-ninjas and no.de is the best thing since ponies, check them out) and posted the link on HN and on fzysqr.com. Whups.

I have learned a few things over the last couple weeks. Good “lessons” I will share with you now:

  1. Don’t actually put your crappy code online, publicly, for abuse. It will crash.
  2. Sanitize inputs for your crappy demo code before you try to run it (in violation of rule number 1). XSS attacks will significantly lessen the quality of the experience you are trying to provide your audience.
  3. Check for nulls. Everywhere. The internet is a cruel place and people are mean. They will look through your crappy demo code and figure out how to crash your crappy demo.
  4. Running production-ish code on node.js requires a different mindset. If anything takes the process down, it is down for everyone. Coming from a typical web-development background, it took much crashing before I realized this. Writing robust, fault tolerant code is CRITICAL if you are hosting it on node.js
  5. If you write a silly chat room and hang out it in all day, you will meet many interesting people.
  6. There is a ton of interest in node.js. People are really excited to work with this stack.

People seemed to enjoy nodechat.js so I have been hacking out new features as fast as I can. Things that have changed since the demo:

  • Authentication: reserve your username now, before they are all gone!
  • Rightside up chat
  • Mashtags: like #hashtags but #mashier
  • Users online: now people are more than numbers
  • Direct messages: now you can tell @jslatts how much you hate the UI in private
  • Notifications: blinky tab thingies
  • Linkify URLS / em / bold
  • Flood control (yes, that one guy who knows who he is, I am thinking of you)
  • Works in Firefox (sorry FF, I don’t test in you)
  • Still Fun Chat Messages only

As always, you can find the latest code at github.

I am working on a follow up tutorial to cover authentication and some other fun tidbits I have discovered in the last couple weeks. Stay tuned.