GithubHelp home page GithubHelp logo

it is giving me an error on the socket.to(roomId).broadcast.emit('user-connected', userId) line of server.js that emit isn't defined why is that about zoom-clone-with-webrtc HOT 4 OPEN

OkGameStudios avatar OkGameStudios commented on June 10, 2024
it is giving me an error on the socket.to(roomId).broadcast.emit('user-connected', userId) line of server.js that emit isn't defined why is that

from zoom-clone-with-webrtc.

Comments (4)

chiamyunqing avatar chiamyunqing commented on June 10, 2024 1

Changing it to socket.broadcast.to(roomId).emit('user-connected', userId) works for me.
Reference: CleverProgrammers/nodejs-zoom-clone#35

Hope this helps.

from zoom-clone-with-webrtc.

Impachouri avatar Impachouri commented on June 10, 2024

I'm also getting the same error but some changes work for me and you can try too.
change that line to this in server.js :- socket.broadcast.to(roomId).emit('user-connected', userId)

if still error occur then make these changes in script.js

  1. remove parameters from const myPeer = new Peer(....)
    after removing it will be - const myPeer = new Peer()
    2.. Replace socket.on('user-connected', userId... function to -
    socket.on('user-connected', userId => {
    console.log("Connected: ", userId)
    setTimeout(() => {
    connectToNewUser(userId, stream)
    }, 1000);
    })
    HOpe this will work

from zoom-clone-with-webrtc.

sanabilmustafa avatar sanabilmustafa commented on June 10, 2024

i was facing the same problem. if you remove the broadcast and directly write:
socket.to(roomId).emit('user-connected', userId)
then i works!! the functionality of broadcast is removed but still you are not gonna face the reference error.

from zoom-clone-with-webrtc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.