Commit 9fa92aa2 authored by Killian Kemps's avatar Killian Kemps
Browse files

Change way the web server starts

parent 857b64af
......@@ -146,11 +146,11 @@ module.exports = function(io) {
console.log('Log: The client disconnected with id ', localUserId);
if(localUserId != null){
numberConnectedUsers--;
}
console.log('There are currenly ', numberConnectedUsers,
' users signed in');
io.emit('numberConnectedUsers', numberConnectedUsers);
users.stopStream(localUserId);
}
});
});
};
......@@ -8,6 +8,8 @@ var bodyParser = require('body-parser');
var mongoose = require('mongoose');
var passportAuthentication = require('./lib/passport');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var port = process.env.PORT || 8080;
// Add some logging
......@@ -65,15 +67,13 @@ passportAuthentication(app);
// Setup the routes
routes(app);
// Express listen at port 8080
var server = app.listen(port);
console.log('Listening at ' + port);
// Socket.io listen at port 8080
var io = require('socket.io').listen(server);
// Give io to the socket
require('./lib/socket')(io);
// Launch server
http.listen(port, function(){
console.log('Listening on *:' + port);
});
// Launch the twitter app
require('./lib/twitter');
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment