public
Created

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
var express = require('express')
, app = express()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server);
/**
* Http Server.
*/
app.use(express.static(__dirname + '/public'));
app.use(app.router);
app.get('/', function(req, res) {
res.sendfile(__dirname + '/index.html');
});
server.listen(8080);
/**
* Socket.io stuff.
*/
io.sockets.on('connection', function(socket) {
// ...
emitter.on('stats', function(stream) {
socket.broadcast.emit('stats', stream);
});
});
io.set('log level', 1);
gistfile2.html
HTML
1
<script src="/socket.io/socket.io.js"></script>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.