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

Socket issue on server #113

Closed
Sameer-hesta opened this issue May 3, 2020 · 11 comments
Closed

Socket issue on server #113

Sameer-hesta opened this issue May 3, 2020 · 11 comments
Labels

Comments

@Sameer-hesta
Copy link

Sameer-hesta commented May 3, 2020

Socket connection error
A clear and concise description of what the bug is.
WebSocket connection to 'wss://demovideo.my-domain.com/ws/123/za80HWiFPN4H4LGAHyIAc7' failed: Error during WebSocket handshake: Unexpected response code: 426

@jeremija
Copy link
Member

jeremija commented May 3, 2020

Thanks for the bug report! Are you are running PeerCalls v4 (master branch) or v4? Can you reproduce this bug on https://peercalls.com/alpha if you're running v4?

@Sameer-hesta
Copy link
Author

Sameer-hesta commented May 3, 2020

Actually I have set up this on ubuntu by git. I install node v8.17.0 and go go1.14.2. When I try to run this on the development by the command npm run start:watch I get the following error
[ wss] Error accepting websocket connection: failed to accept WebSocket connection: WebSocket protocol violation: Connection header "Keep-Alive" does not contain Upgrade

And on the browser, I am getting following error on the console

WebSocket failed: connection to 'wss://domain/ws/123/kknGxoDSfYpHNIJn4SlDT5' Error during WebSocket handshake: Unexpected response code: 426

I am using https Help will we appreciated

@jeremija
Copy link
Member

jeremija commented May 3, 2020

Are you running Peer Calls behind a proxy server?

@Sameer-hesta
Copy link
Author

Sameer-hesta commented May 3, 2020

Are you running Peer Calls behind a proxy server?

Yes I am using apache as a proxy server

@jeremija
Copy link
Member

jeremija commented May 3, 2020

You need to ensure your proxy is configured to support websocket connections for Peer Calls.

I'm using nginx, and it has these settings:

        proxy_set_header Upgrade                          $http_upgrade;
        proxy_set_header Connection                       "upgrade";

You need to find an equivalent for Apache, possibly the wstunnel module.

@Sameer-hesta
Copy link
Author

Sameer-hesta commented May 3, 2020

Thank you but already enabled proxy_wstuneel

My proxy command like this in host file

*ProxyPreserveHost On
<Proxy >
Order allow,deny
Allow from all

ProxyPass / http://localhost:3000/ connectiontimeout=600 timeout=600 Keepalive=On
ProxyPassReverse / http://localhost:3000/
ProxyPass /wss2/ ws://domain:3000/
ProxyPassReverse /wss2/ ws://domain:3000/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

I also try to change ws path in src/client/ws/index.ts to wss://domain/wss2

But no luck

@jeremija
Copy link
Member

jeremija commented May 3, 2020

Do you have HTTP 2 enabled?

@Sameer-hesta
Copy link
Author

Yes

@jeremija
Copy link
Member

jeremija commented May 3, 2020

Can you try disabling HTTP/2 for /ws path? There's an issue with a websocket library (or Golang) with websockets and HTTP/2: nhooyr/websocket#4

@Sameer-hesta
Copy link
Author

Sameer-hesta commented May 3, 2020

Mate thank you for your response

I have modified apache config for WebSocket

RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule .
ws://localhost:3000%{REQUEST_URI} [P]
*

and thats it

@jeremija
Copy link
Member

jeremija commented May 3, 2020

Glad you were able to resolve it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants