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) { ...@@ -146,11 +146,11 @@ module.exports = function(io) {
console.log('Log: The client disconnected with id ', localUserId); console.log('Log: The client disconnected with id ', localUserId);
if(localUserId != null){ if(localUserId != null){
numberConnectedUsers--; numberConnectedUsers--;
console.log('There are currenly ', numberConnectedUsers,
' users signed in');
io.emit('numberConnectedUsers', numberConnectedUsers);
users.stopStream(localUserId);
} }
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'); ...@@ -8,6 +8,8 @@ var bodyParser = require('body-parser');
var mongoose = require('mongoose'); var mongoose = require('mongoose');
var passportAuthentication = require('./lib/passport'); var passportAuthentication = require('./lib/passport');
var app = express(); var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var port = process.env.PORT || 8080; var port = process.env.PORT || 8080;
// Add some logging // Add some logging
...@@ -65,15 +67,13 @@ passportAuthentication(app); ...@@ -65,15 +67,13 @@ passportAuthentication(app);
// Setup the routes // Setup the routes
routes(app); 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 // Give io to the socket
require('./lib/socket')(io); require('./lib/socket')(io);
// Launch server
http.listen(port, function(){
console.log('Listening on *:' + port);
});
// Launch the twitter app // Launch the twitter app
require('./lib/twitter'); 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