websocket connection fails in Ubuntu 13.10
Asked Answered
B

1

7

We're having a weird problem at work and I'm hoping someone here can give me some ideas on how to troubleshoot it.

The problem is that I cannot make websocket connections from my Kubuntu 13.10 workstation. I've tried from both Chrome and Firefox. I'm behind a proxy and first I thought that must be the reason. However, I got some coworkers to try to connect to the same websocket echo demo and all of them were able to, except one. He was the only one running Ubuntu (same as me), the others were on Mac, Windows and even one on RedHat! Theirs all worked fine.

Ok, so now for the really weird part. I created and ran a virtual machine on my workstation (the one that couldn't connect). The VM is a Lubuntu 13.10 and what do you know, the darn thing establishes a websocket connection just fine!

So any ideas on how to troubleshoot this or even some suggestions for solutions would be very much appreciated.

Breakwater answered 8/3, 2014 at 23:23 Comment(2)
How do you make your connections? How does the setup looks like? Have you implemented your own web socket server or are you connecting to a public one?Hipster
I've tried connecting to a local (nodejs) websocket server that I run locally on my computer and that works. What didn't work was any web page that uses websockets. I tried a few but most notable were probably websocket.org/echo.html and websocketstest.com. Neither of those worked. So it has something to do with the combination of Ubuntu and the network we're on.Breakwater
B
14

Ugh... well that one was dumb.

So it turns out that in Linux you can check a checkbox in your Network Proxy settings (the system settings) that will use the same proxy for all protocols.

Yeah... don't do that!

Unless, that is, your proxy server supports SOCKS as well as HTTP/HTTPS/FTP (highly unlikely).

It turns out that if you check that checkbox, your proxy server will be registered as a SOCKS proxy and for some reason, websocket connections in both Chrome and Firefox will want to use that. So your HTTP proxy will end up getting a bunch of weird SOCKS handshakes that it doesn't understand and any websocket connection will fail.

This was tested on both Ubuntu and Kubuntu and the "problem" exists on both.

TL;DR; Don't check the "Use this proxy server for all protocols" checkbox unless your proxy server supports the SOCKS protocol. Instead, manually fill in the same server for the different protocols (http, https and ftp) but leave the socks protocol empty (or point to an actual socks proxy server).

Breakwater answered 17/3, 2014 at 1:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.