Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect #693

Closed
adimathur08 opened this issue Jul 4, 2020 · 24 comments
Closed

Unable to connect #693

adimathur08 opened this issue Jul 4, 2020 · 24 comments

Comments

@adimathur08
Copy link

Getting error https://0.peerjs.com/peerjs/id?ts=15938580580230.27749202685512375 net::ERR_CONNECTION_TIMED_OUT since the latest update.

@taminhtienhai
Copy link

Fix cloud server please, I'm having a final project at the moment. I must finished it before tomorrow.

@sheibeck
Copy link

sheibeck commented Jul 4, 2020

Looks like this is a server issue.

I'm having the same issue. It worked yesterday in the evening around 8pm EST, but since today when I tried running my code again, timeouts on 0.peerjs.com. I even tried to spin up a server on gitpod, but I'm having the same issues there. I'm not sure if this is a peerjs-server issue or not, I was getting the following results when running peerjs-1.2 and peerjs-1.3.

OS: Windows 10
Browsers: Chrome Version 83.0.4103.116 and Firefox 78.0.1

Attempt with custom peerId
peerjs.min.js:52 WebSocket connection to 'wss://0.peerjs.com/peerjs?key=peerjs&id=c-pU_AYDp&token=a6g0yo6t7ma' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

Attempt with server autogenerated id
peerjs.min.js:64 GET https://0.peerjs.com/peerjs/id?ts=15938872126070.5702383625139162 net::ERR_CONNECTION_TIMED_OUT

@Andy-Kerr
Copy link

Andy-Kerr commented Jul 5, 2020

I have been trying to learn how to use PeerJS and the example at https://peerjs.com/examples.html does not work. I think there is an issue with the PeerJS cloud server.

@taminhtienhai
Copy link

I found out that deploy your own peerjs-server solve all your problem

@sheibeck
Copy link

sheibeck commented Jul 5, 2020

Where did you deploy your server? A cloud service or self hosted?

@taminhtienhai
Copy link

Where did you deploy your server? A cloud service or self hosted?

You can go this link https://github.com/peers/peerjs-server, click on 'Open on Gitpod' and start your own new peer-server. With those config
new Peer([id], { host: [your-host-name], port: 443, secure: true })
Until now my server can connect but send message got some error. Maybe you can try and help me solve it.

@adimathur08
Copy link
Author

Where did you deploy your server? A cloud service or self hosted?

You can go this link https://github.com/peers/peerjs-server, click on 'Open on Gitpod' and start your own new peer-server. With those config
new Peer([id], { host: [your-host-name], port: 443, secure: true })
Until now my server can connect but send message got some error. Maybe you can try and help me solve it.

I've created a new server but I'm getting this error.
Error: Could not get an ID from the server. If you passed in a 'path' to your self-hosted PeerServer, you'll also need to pass in that same path when creating a new Peer

How do I fix this?

@sheibeck
Copy link

sheibeck commented Jul 5, 2020

Adimarthur8: You'll need to manually specify an I'd if your peerjs server isn't setup to automatically generate them.

And I tried gitpod, but it wouldn't connect for me. I eventually got heroku working. I was missing the secure: true. That was the key for me.

@getnoisy
Copy link

getnoisy commented Jul 5, 2020

Seems to work on gitpod although a bit unintuitive ...

peer = new Peer(
  {
    host: 'yourPersonalGitPodKey.gitpod.io',
    port: '443',
    path: '/',
    secure: true
  });

Note path (/), port (443), secure (to enable https rather than http).

Also:
You can get URL from the gitpod "preview" window - you will see port number there (443 in my case).
You can see see logs in gitpod terminal.
You can also start server in terminal -> npm start

@rayanehmd
Copy link

Seems to work on gitpod although a bit unintuitive ...

peer = new Peer(
  {
    host: 'yourPersonalGitPodKey.gitpod.io',
    port: '443',
    path: '/',
    secure: true
  });

Note path (/), port (443), secure (to enable https rather than http).

Also:
You can get URL from the gitpod "preview" window - you will see port number there (443 in my case).
You can see see logs in gitpod terminal.
You can also start server in terminal -> npm start

Hi, I've done what you did and now the client can initialize a new Peer with an ID.
However, when I try to connect two Peers together, the Peer client who is trying to connect trigger an error like that : ERROR PeerJS: Error: Could not connect to peer 377b4bb0-3101-4af0-9203-f85210

I've tried many time with differents browsers but always the same result, it's impossible to connect two Peers together.

Also, the Peer client who is waiting for a connection don't trigger any messages or errors in the console (I have activated debug : 3 in the Peer parameters)

@adimathur08
Copy link
Author

Adimarthur8: You'll need to manually specify an I'd if your peerjs server isn't setup to automatically generate them.

And I tried gitpod, but it wouldn't connect for me. I eventually got heroku working. I was missing the secure: true. That was the key for me.

Deploying a private server on Heroku made it work!

@getnoisy
Copy link

getnoisy commented Jul 5, 2020

I am thinking that if you received ID, signalling/brokering is working.

Not sure if related to your issue but for chrome browsers (may others as well) one needs to manually set:

peer.on('connection', function(data){
...
data.open = true;
})

@taminhtienhai
Copy link

I alway got this error every time send a message, how can I fix it?
image

@Andy-Kerr
Copy link

I think i know what the problem is.. (i'm new to this so feel free to correct me)

I opened the link to the js file.. and found that the url to the sourceMappingfile at the end was /peerjs.min.js.map
so I tried to visit https://unpkg.com/peerjs@1.3.0/dist/peerjs.min.js.map and apparently that link does not exist..
I checked for the latest peerjs file sourcemap using this link and found that it was 1.2.0 (i think this is the latest as of now?)
So then i checked the url: https://unpkg.com/peerjs@1.2.0/dist/peerjs.min.js.map (notice the version)
and it worked ..
So either the either the sourceMapping url in the original file must be changed or the url that it points to must be available..

Simplest fix i think would be to use the https://unpkg.com/peerjs@1.2.0/dist/peerjs.min.js (the old version )(i haven't used it though)

Another way to fix this would be (but not sure i'ts okay to do this..)

  1. download the [peerjs.min.js] (https://unpkg.com/peerjs@1.3.0/dist/peerjs.min.js)
  2. download the peerjs.min.js.map (the old version)
  3. include these downloaded file in your html
    Note that the two files must be in the same folder else you have to edit the peerjs.min.js file and edit the //#sourceMappingURL=/peerjs.min.js.map to //# sourceMappingURL=<path to the map file>

Here is a temporary "solution" that can be used individually for the meantime, but it does not fix the net issue with the site or examples.

@GemsGame
Copy link

GemsGame commented Jul 11, 2020

Hi, I've done what you did and now the client can initialize a new Peer with an ID.
However, when I try to connect two Peers together, the Peer client who is trying to connect trigger an error like that : ERROR PeerJS: Error: Could not connect to peer 377b4bb0-3101-4af0-9203-f85210

I've tried many time with differents browsers but always the same result, it's impossible to connect two Peers together.

Also, the Peer client who is waiting for a connection don't trigger any messages or errors in the console (I have activated debug : 3 in the Peer parameters)

same problem

@afrokick
Copy link
Member

afrokick commented Jul 11, 2020

the map file was fixed in 1.3.1

@kredenac
Copy link

kredenac commented Jul 20, 2020

Using this minimal example:

<head>
    <script src="https://unpkg.com/peerjs@1.3.1/dist/peerjs.min.js"></script>
    <script>
        const peer = new Peer();
    </script>
</head>
<body>
    Hi!
</body>

There's an error
peerjs.min.js:64 GET https://0.peerjs.com/peerjs/id?ts=15952851209220.3286421092199203 net::ERR_CONNECTION_REFUSED
Windows 10, Chrome/84.0.4147.89

Are servers down, when will they be up?

This error is gone when using server deployed on gitpod

Edit: server is now working again

@rexthonyy
Copy link

Using this minimal example:

<head>
    <script src="https://unpkg.com/peerjs@1.3.1/dist/peerjs.min.js"></script>
    <script>
        const peer = new Peer();
    </script>
</head>
<body>
    Hi!
</body>

There's an error
peerjs.min.js:64 GET https://0.peerjs.com/peerjs/id?ts=15952851209220.3286421092199203 net::ERR_CONNECTION_REFUSED
Windows 10, Chrome/84.0.4147.89

Are servers down, when will they be up?

This error is gone when using server deployed on gitpod

Edit: server is now working again

I had this problem on localhost, but it turns out that I had not started the peerjs server. After starting the server, the problem was fixed.

@ZamanMehdi
Copy link

I have found a solution for a similar kind of problem. Actually, the peer server runs on HTTP protocol, and for making it run on HTTPS protocol, we need to generate an SSL key and certificate. Even after generating these things, it will only run on the localhost server and the systems connected to that network.

There is a peer server hosted on a Heroku, so it is running on HTTPS, rather than using your own peer server, we can use the path of the Heroku peer server and then host the app on some hosting website, The app will run properly. I had solved my problem with this.
peer = new Peer({host:'peerjs-server.herokuapp.com', secure:true, port:443})

@ColleSerre
Copy link

@ZamanMehdi do you mind if I use this server ? 0.peerjs.com seems to go down too often.

@ZamanMehdi
Copy link

You can use the sever I mentioned, about your's I haven't used that because I'm able to resolve my problem with that.

@kidandcat
Copy link
Member

Contacted OVH support and the public open server is now up.

@MajorDeanSimba
Copy link

Hello,
We are/were providing our members free Video chat service and for the WebRTC Peer ID we were relying on this Peerjs.
But as you know all of a sudden, as of 3 days ago, the Peerjs is not connecting - that is:

<script src="https://unpkg.com/peerjs@1.3.1/dist/peerjs.min.js"></script>

is leading to:
Failed to load resource: https://0.peerjs.com/peerjs/id?ts=16484790214020.2959546042947947 CONNECTION_TIMED_OUT

So we need to run the Peerjs server on our own server so we can get the Peer IDs on our own rather than relying
on this Peerjs cloud service which is so all of sudden unreliable :(
But instructions to do so here: https://github.com/peers/peerjs-server
are not working. So we need help to set up this Peerjs server to run on our server and then how the client, browser, should connect to this to get the Peer Ids.

Can you please contact me on Urgent basis to take care off this since we have 2.5 Million+ members and we had
informed them of this new Video chat service, as you can see here:
https://www.anoox.com/chat/video_chat_description.php

that all of a sudden is not working due to the simple peer ID that we were getting from Peerjs.
My direct email is: dean_ansari@anoox.com

Thanks

@kidandcat
Copy link
Member

I answered you in the other issue.

Also this as a duplicate of #939

@kidandcat kidandcat pinned this issue Mar 28, 2022
@kidandcat kidandcat unpinned this issue Mar 28, 2022
@peers peers locked as spam and limited conversation to collaborators Mar 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests