Skip to content

Instantly share code, notes, and snippets.

@jandrieu
Created September 16, 2016 11:01
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 jandrieu/da31325e5f20f54e3581ff2aa4dd05bd to your computer and use it in GitHub Desktop.
Save jandrieu/da31325e5f20f54e3581ff2aa4dd05bd to your computer and use it in GitHub Desktop.
failing socket.io
var app = require('express')();
var http = require('http').Server(app);
app.listen(configPort, function () {
console.log('Config webserver listening on port ' + configPort);
});
var io = require('socket.io')(http);
app.get('/', function (req, res) {
res.sendFile(__dirname + '/public/index.html');
});
app.get('/socket.io/socket.io.js', function (req, res) {
res.sendFile(__dirname + '/public/socket.io.js');
});
io.on('connection', function (socket) {
console.log('websocket client connected');
socket.emit('welcome', msg);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment