Zemke / react-native-peerjs

PeerJS for React Native
55 stars 36 forks source link

Unable to connect to my server #5

Closed mxvsh closed 4 years ago

mxvsh commented 4 years ago

Hi, I am running a local Peer JS server on my computer. When I try to connect to my server using react-native=peerjs it returns an error, ReferrenceError: Can't find variable: location

Code:

this.peer = new Peer('some-id', {
      host: 'http://192.168.0.12',
      port: 7900,
      path: '/'
 });
Ponao commented 4 years ago

Hey, you use https? If yes, you need write to this.peer = new Peer('some-id', { host: '192.168.0.12', secure: true, port: 7900, path: '/' });

if not

this.peer = new Peer('some-id', { host: '192.168.0.12', secure: false, port: 7900, path: '/' });

Zemke commented 4 years ago

Thanks for the answer, @Ponao. Closing this as there's no further feedback.