DEV Community

Discussion on: Let’s Build a Video Chat App with JavaScript and WebRTC

Collapse
 
robertloeberdevelopment profile image
Robert Loeber

I found it. I had the same error.
line 47, index.js:
var numClients = clientsInRoom ? Object.keys(clientsInRoom.sockets).length : 0;
change it to:
var numClients = clientsInRoom ? Object.keys(clientsInRoom).length : 0;

the first time there is no room, and the object is made bij 'join' with teh name of the room. When the second user joins, the room object is made but:
'sockets' appears not to be a property,and gives 'undefined'. so leave it out.
It probably has to to with different versions of socket.io. It took a couple of hours to find this out.