Skip to content

Instantly share code, notes, and snippets.

@nash716
Created December 19, 2011 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nash716/1497527 to your computer and use it in GitHub Desktop.
Save nash716/1497527 to your computer and use it in GitHub Desktop.
server.js
var io = require('socket.io');
var express = require('express');
var app = express.createServer();
app.configure(function(){
app.use(express.static(__dirname));
app.use(express.logger());
app.use(app.router);
});
app.listen(12000);
var socket = io.listen(app);
socket.on('connection', function(client) {
client.on('message', function(mes) {
client.broadcast(mes);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment