Oliver Nassar

Getting a Socket.IO example up and running..

November 10, 2010

Following up on my Installing npm (node package manager) on Ubuntu 10.10 post, I've made some strides into getting a working example up and running. It took me about 10-15 minutes, but I thought I'd post it as there were a couple things to keep in mind if I were to walk someone else through it. First thing is to grab the Socket.IO git repo from https://github.com/LearnBoost/Socket.IO-node.

My way was pretty simple: hit the big download button in the top right, choose the most recent one, and save it somewhere in your webroot.

The problem I ran into was that hitting the example file /socket.io-node/example/chat.html wasn't working as the JS files they're pointing to are:

<script src="/json.js"></script> <!-- for ie -->
<script src="/socket.io/socket.io.js"></script>

In my case, they needed to be:

<script src="/socket.io-node/example/json.js"></script> <!-- for ie -->
<script src="/socket.io-node/support/socket.io-client/socket.io.js"></script>

Strange that they'd be so drastically different (especially the second script asset). As soon as I did that and hit the page, I was good to go. Right now, blown away by how fast it is, but very curious as to where/how this data is being stored (eg. refresh the page after you've chatted with yourself a bit, and the data is still there). Local storage of the entire chat transcript? Flat files? Hmmm.