Skip to content

Code doen't work in socket.io 1.0+ #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lisptime opened this issue Sep 16, 2014 · 8 comments
Open

Code doen't work in socket.io 1.0+ #1

lisptime opened this issue Sep 16, 2014 · 8 comments

Comments

@lisptime
Copy link

For example the line

var numClients = io.sockets.clients(room).length;

in completeNodeServerWithDataChannel.js.

@ghost
Copy link

ghost commented Jun 23, 2015

This seems to work:
socketio/socket.io#1544 (comment)

@maverick-zhn
Copy link

I have used this on the server:

var namespace = '/';
var roomName = room;
var counter = 0;
for (var socketId in io.nsps[namespace].adapter.rooms[roomName]) {
  console.log(socketId);
  counter++;
}
console.log("Counter: " + counter);
var numClients = counter;
console.log('numclients = ' + numClients);

@areski
Copy link
Contributor

areski commented Aug 28, 2015

FYI, I opened a PR here #2

@ChandanLal
Copy link

socket.io.js not found

@maverick-zhn
Copy link

Hey, did you install socket.io? If you use Node.JS you can do this using:
npm install socket.io
In addition, you will also need to install "node-static" and "http" (signaling server side), let me know if that helps.

@ChandanLal
Copy link

Sorry for late reply. I am attaching the error image with this mail. Please
check it.

On Wed, Sep 23, 2015 at 10:41 PM, Servio Palacios [email protected]
wrote:

Hey, did you install socket.io? If you use Node.JS you can do this using:
npm install socket.io
In addition, you will also need to install "node-static" and "http"
(signaling server side), let me know if that helps.


Reply to this email directly or view it on GitHub
#1 (comment).

@flyinglove
Copy link

hey,i'm testing your code sample "SimpleNodeServer_OReilly_Review",But I got this error
default,I just start to learn webrtc and nodejs,I want to know how to fix it,

@maverick-zhn
Copy link

Hey,

This line cause the error:
var index = ns.connected[id].rooms.indexOf(roomId) ;

Could you please take a look to this: http://www.unknownerror.org/opensource/Automattic/socket.io/q/stackoverflow/6563885/socket-io-how-do-i-get-a-list-of-connected-sockets-clients

Let me know if helps,

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants