peers / peerjs

Simple peer-to-peer with WebRTC.
https://peerjs.com
MIT License
12.48k stars 1.43k forks source link

PeerJS Error: Invalid key provided. #354

Closed fiveone7 closed 5 years ago

fiveone7 commented 8 years ago

I have downloaded & installed peerjs server. Also I could run the server without error (:)) But while connecting to server (javascript), I see error "PeerJS: ERROR Error: Invalid key provided" in Chrome browser console.

I changed CLOUD_HOST from 0.peerjs.com to '192.168.1.100', my local address.

What could be the problem?

Please help me.

Lovinity commented 5 years ago

This issue needs fixed. I located the problem in the peer.js compiled source (unminified).

Line 576 defines options.key = "peerjs". This means whatever you provide in options as key, it always gets changed back to peerjs. This is a problem for servers using custom keys. This line should be removed, and instead in the "options = util_1.util.extend" object, a key: "peerjs" is added. This way, the default key value is peerjs, but if one is provided in the Peer constructor options, it will use that instead.

Lovinity commented 5 years ago

Could I have an explanation as to why this issue was closed please?

afrokick commented 5 years ago

Could I have an explanation as to why this issue was closed please?

Of course.

We fixed it in master branch,

    options = {
      debug: 0, // 1: Errors, 2: Warnings, 3: All logs
      host: util.CLOUD_HOST,
      port: util.CLOUD_PORT,
      path: "/",
      key: Peer.DEFAULT_KEY,
      token: util.randomToken(),
      config: util.defaultConfig,
      ...options
    };
    this._options = options;

Sorry that didn't provide the explanation before

Lovinity commented 5 years ago

Okay thanks for updating us!