Zemke / react-native-peerjs

PeerJS for React Native
55 stars 36 forks source link

works fine in LAN. But doesn't work outside of LAN. what's the problem? #21

Open rezaul28 opened 3 years ago

rezaul28 commented 3 years ago

export const myPeer = new Peer({ host: 'XXX.XXX.X.XXX', secure: false, port: '5000', path: '/peerjs', });

cardyy commented 3 years ago

url has to be https, its its just http it will not accept streams coming from an unsercure sourse

adekunle11 commented 3 years ago

@rezaul28 you need to config a TURN server in your new Peer ({}) to connect outside LAN

like const peerServer = new Peer(undefined, { host: 'm.herokuapp.com', config: { iceServers: [ { urls: ['stun:stun1.l.google.com:19302'] }, { username: 'epz-hBZGVrdW5sZTE=', credential: 'c531d3-a2e6-0242a140004', credentialType: 'password', urls: [ "turn:us-turn4.xirsys.com:80?transport=udp", "turn:us-turn4.xirsys.com:3478?transport=udp", "turn:us-turn4.xirsys.com:80?transport=tcp", "turn:us-turn4.xirsys.com:3478?transport=tcp", "turns:us-turn4.xirsys.com:443?transport=tcp", "turns:us-turn4.xirsys.com:5349?transport=tcp" ] } ] }, secure: true, port: 443, path: '/mypeer' })