I was able to get the basic socket.io server application running on my own server, and request it directly through any web browser (I tried FF, chrome, and IE7 which all wor
I use browserify to manage all the require() resources for the browser-side code.
That said, I was able to require the socket.io-client on my browser-side code in the following way:
var io = require('socket.io-client');
var $ = require('jquery');
var socket = io();
$('form').submit(function(){
socket.emit('chat message', $('#m').val());
$('#m').val('');
return false;
});
socket.on('chat message', function(msg){
$('#messages').append($('<li>').text(msg));
});
As opposed to the following snippet using a traditional script tag format found on socket.io's github example: https://github.com/rauchg/chat-example/blob/master/index.html
socket.io-client can be downloaded in your development environment as a node modulo by doing:
npm install socket.io-client