Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion config/development.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"isDev": true,
"logLevel": 3,
"server": {
"port": 8888,
"/* secure */": "/* whether this connects via https */",
Expand Down
1 change: 0 additions & 1 deletion config/production.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"isDev": false,
"logLevel": 3,
"server": {
"port": 8888,
"/* secure */": "/* whether this connects via https */",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dependencies": {
"getconfig": "2.1.0",
"node-uuid": "1.2.0",
"socket.io": "^1.3.7",
"socket.io": "1.3.7",
"yetify": "0.0.1"
},
"main": "server.js",
Expand All @@ -14,7 +14,7 @@
"url": "[email protected]:andyet/signal-master.git"
},
"devDependencies": {
"socket.io-client": "0.9.16",
"socket.io-client": "1.4.5",
"precommit-hook": "0.3.10",
"tape": "^2.13.1"
},
Expand Down
11 changes: 5 additions & 6 deletions sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ var socketIO = require('socket.io'),
module.exports = function (server, config) {
var io = socketIO.listen(server);

if (config.logLevel) {
// https://github.com/Automattic/socket.io/wiki/Configuring-Socket.IO
io.set('log level', config.logLevel);
}

io.sockets.on('connection', function (client) {
client.resources = {
screen: false,
Expand Down Expand Up @@ -142,7 +137,11 @@ module.exports = function (server, config) {
}

function clientsInRoom(name) {
return io.sockets.clients(name).length;
var clientsCount = 0;
for (var socketId in io.nsps['/'].adapter.rooms[name] || {}) {
clientsCount++;
}
return clientsCount;
}

};
Expand Down