public
Last active

  • Download Gist
gistfile1.html
HTML
1
<script src="/test/socket.io/socket.io.js"></script>
gistfile2.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 26 27 28 29 30 31 32 33 34 35 36
var express = require('express')
, app = express()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server)
, httpProxy = require('http-proxy');
 
/**
* Http Server.
*/
app.use(express.static(__dirname + '/public'));
app.use(app.router);
app.get('/', function(req, res) {
res.sendfile(__dirname + '/index.html');
});
server.listen(1337);
 
/**
* Socket.io stuff.
*/
io.sockets.on('connection', function(socket) {
// ...
emitter.on('stats', function(stream) {
socket.broadcast.emit('stats', stream);
});
});
io.set('log level', 1);
 
/**
* Proxy Server
*/
var options = {
router: {
'dev.example.com/test': '127.0.0.1:1337',
}
}
var proxyServer = httpProxy.createServer(options).listen(8080);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.