websockex icon indicating copy to clipboard operation
websockex copied to clipboard

How to use WebSockex through a http proxy

Open tht opened this issue 8 years ago • 2 comments

I need to open a websocket connection through a http proxy. The proxy does support websockets when I use a web browser as client.

Is there a way to configure WebSockex to use an http proxy?

tht avatar Sep 02 '17 14:09 tht

Looks like supporting a proxy is not that difficult.

You have to redirect the TCP socket, send a request to the proxy and parse its response. After this additional step everything else is the same as before.

I hacked it into your library, the result is here: https://github.com/tht/websockex

It seems to work nicely but it's far from being ready for a pull request. SSL is not supported when using a proxy and there are no tests.

tht avatar Sep 02 '17 20:09 tht

Awesome, thanks for the heads up and working code sample.

I'll look into getting this integrated or if nothing else at least a way to make a request through an existing proxy connection.

Azolo avatar Sep 14 '17 21:09 Azolo