WebDevSimplified / Zoom-Clone-With-WebRTC

1.52k stars 863 forks source link

TypeError: Cannot read property 'emit' of undefined #58

Open viablitz opened 3 years ago

viablitz commented 3 years ago

At the 'broadcast' line of code added in the video at T=14.12 - as far as I can tell something about the socket object being overwritten.

Testing at T=14.36 crashes the app. Please help

arnavkanaujia commented 3 years ago

use socket.broadcast.to(roomId).emit("user-connected",userID) instead of socket.to(roomId).broadcast.emit("user-connected",userID)

nahmed99 commented 3 years ago

Thanks arnavkanaujia. Your solution worked. I had that problem since last night - I even started the whole app again from the beginning.

ghost commented 2 years ago

@viablitz if @arnavkanaujia’s solution worked, can you close the issue?