peerjs peer.connect not opened for some users

29 Views Asked by At

PeerJs Server: custom server on nodejs

Client: Electron App

everything working great but it's not working on some users' devices without errors after debugging I have figured that peer.connect never opens even on setTimeOut

const handelPeer = async (peerId: string) => {
    const id = `${Math.random().toString(16).slice(2)}_${user?.username
      ?.replaceAll(' ', '_')
      .toString()!}`;


    const peer = new Peer(id, {
      host: 'xxx.xxxx.xxx',
      path: '/peerjs',
      secure: true,
    });


    peer.on('open', () => {
   
      const connection = peer.connect(peerId); // Never open on some users 

      connection.on('open', async () => {

        // never getting here on some users
      });

    });

  };
console.log(connection)

enter image description here

many people say I have to change the stun server I tried to change it with Google & some many others nothing changed

0

There are 0 best solutions below