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

Websocket connection now failing without any apparent reasons #674

Open
marcoippolito opened this issue May 25, 2020 · 7 comments
Open

Websocket connection now failing without any apparent reasons #674

marcoippolito opened this issue May 25, 2020 · 7 comments
Labels
client related to peerjs client

Comments

@marcoippolito
Copy link

marcoippolito commented May 25, 2020

I left the web-app friday night with no problems.
Today, I'm experiencing something I do not understand, since during weekend I didn't touch anything at all:

"peerjs.min.js?a0bc:52 WebSocket connection to 'wss://0.peerjs.com/peerjs?key=peerjs&
id=bemz4x7v4ua00000&token=7k5a8y9cso' failed: Connection closed before receiving a 
handshake response
o.start @ peerjs.min.js?a0bc:52
i._initialize @ peerjs.min.js?a0bc:66
eval @ peerjs.min.js?a0bc:66"

I tried many times, and only twice I got the connection working fine (and without doing anything special)...
ERR_CONNECTION_REFUSED-01

What kind of causes could lead the web socket connection to fail?
Looking forward to your kind help.
Marco

@Florrr
Copy link

Florrr commented May 26, 2020

See #671 (comment).
The public signaling server seems to by unstable at the moment. Consider setting up your own signaling-server

@marcoippolito
Copy link
Author

marcoippolito commented May 26, 2020

@Florrr Hi Florian!
I'm trying to understand how to setup a signaling-server, but I have some doubt about it:
in my Peerjs.vue file I created a new server using PeerServer object:

My app is running behind an nginx proxy server.

data: () => ({
    peerServer: PeerServer({
        port: 9000,
        path: '/ggc',
    }),

But when I run npm run server I get this error:

image

If I run the server as follows:

$ peerjs --port 9000 --key peerjs --path /myapp
Started PeerServer on ::, port: 9000, path: /myapp (v. 0.5.3)

Going in the browser to http://127.0.0.1:9000/myapp

image

In Peerjs.vue I substitute the "old" Peer creation with:

  created() {
    //this.myPeer = new Peer()
    this.myPeer = new Peer(1, {
      host: 'localhost',
      port: 9000,
      path: '/myapp'
    })

    this.myPeer.on('open', () => {
      console.log('this.myPeer.id: ' + this.myPeer.id + ' this.myPeer.key: ' + this.myPeer.key);
    })

Still get this error:
"WebSocket connection to 'wss://localhost:9000/myapp/peerjs?key=peerjs&id=1&token=xueb5dzxk4l' failed: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR
"

image

How to solve the problem?
Looking forward to your kind help.
Marco

@marcoippolito
Copy link
Author

marcoippolito commented May 26, 2020

@Florrr I opened a new issue here about the signaling server setup: peers/peerjs-server#193

@natesire
Copy link

natesire commented May 28, 2020

I just spent three hours today diagnosing a similar problem. The SSL protocal sslv3 was being used. The node server had never been updated. sslv3 is deprecated. Need to make sure the node server, nginx, apache are using the latest tls 1.2 Or your browser will throw an error. In firefox...

about:config

security.tls

@natesire
Copy link

I setup a signaling server on heroku to test it.

peerjs.min.js is changing the protocol to ws (non secure)

var peer = new Peer('natusdrew2', { host: "wss://hidden-beach-54481.herokuapp.com/myapp", key: "natuskey2" } )

https://javascript.info/websocket

Says to use wss://

I think peerjs.min.js just needs to fix the parsing of the url. That's why we are receiving the SSL error. It's downgrading it to a ws:// connection.

ws

@marcoippolito
Copy link
Author

Interesting @natusdrew .

So... @Florrr what kind of solutions can we use? At the moment I'm stuck here: peers/peerjs-server#193

@Florrr
Copy link

Florrr commented Jun 1, 2020

@natusdrew you probably need to specify the "host"-value without the wss:// prefix. this is added automatically (wss or ws depending on the secure-property).
If you want to connect using wss use:
var peer = new Peer('natusdrew2', { host: "hidden-beach-54481.herokuapp.com/myapp", key: "natuskey2", secure: true } )
for connecting using ws:
var peer = new Peer('natusdrew2', { host: "hidden-beach-54481.herokuapp.com/myapp", key: "natuskey2", secure: false } )

@irgalamarr irgalamarr added the client related to peerjs client label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client related to peerjs client
Projects
None yet
Development

No branches or pull requests

4 participants