display active connections
This commit is contained in:
parent
1d8acbbd72
commit
232f9d5b47
3 changed files with 20 additions and 8 deletions
14
server.js
14
server.js
|
@ -32,14 +32,24 @@ server.listen(port);
|
|||
|
||||
console.log('Server running at http://127.0.0.1:' + port + '/');
|
||||
|
||||
/**************
|
||||
SETUP Socket.IO
|
||||
**************/
|
||||
var io = require('socket.io')(server);
|
||||
|
||||
/**************
|
||||
ROUTES
|
||||
**************/
|
||||
app.get('/', function(req, res) {
|
||||
//console.log(req.header('host'));
|
||||
url = req.header('host');
|
||||
|
||||
var connected = io.sockets.connected;
|
||||
clientsCount = Object.keys(connected).length;
|
||||
|
||||
res.render('home.jade', {
|
||||
url: url
|
||||
url: url,
|
||||
connected: clientsCount
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -61,8 +71,6 @@ app.get('/:id', function(req, res){
|
|||
/**************
|
||||
SOCKET.I0
|
||||
**************/
|
||||
var io = require('socket.io')(server);
|
||||
|
||||
io.sockets.on('connection', function (client) {
|
||||
//santizes text
|
||||
function scrub( text ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue