All Topics:
apps
css
dashboard
games
javascript
mobile
node
php
tehcl
textmate
tools
video

Topic: node

Curious First Look at Socket.IO and node.js

published:
2011.08.17
topics:
javascript
node

Being fairly new to node.js, and even newer to the use of Socket.IO, I had a very interesting morning exploring some of the behaviors of Socket.IO. I thought I'd share the things that raised my eyebrows. There were some good lessons hidden in a basic Hello World example. There was also a really interesting question posed by the feature of Socket.IO that allows for a callback to be executed as an acknowledgement that a sent socket message was received.

I don't want to spend a ton of time on getting started with node.js or learning Socket.IO. But you should know that I'm just talking about a default, easy to replicate install of node and io. All I basically did is brew install node, curl http://npmjs.org/install.sh | sh, npm install socket.io and I'm off writing realtime code.

Hello World Has Surprise Lessons

The first thing I noticed is that it is a bit surprising — even alarming — how little you need to get a hello world example working. Let me show you the example and then explain the alarming part.