racinette / websockets_proxy

Connect to websockets through a proxy server.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

some questions with example code

basiicj133 opened this issue · comments

I just used your lib to replace the origin websocket in tiktoklive repo, then I got some traceback like
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 200
then I use your example code to see if it is just problems in that repo, but I got traceback websockets.exceptions.InvalidMessage: did not receive a valid HTTP response too.

I modified codes in Client that CHECKER_URL to ws://127.0.0.1:54321 and proxy to proxy = Proxy.from_url("http://localhost:7890")
and my running OS is Windows 11, with python 3.11.3

Firstly, you should provide a minimal reproducible example.
Secondly, this doesn't seem to be a problem with the package itself, since you suggest, that the original websockets client doesn't handle this endpoint.
Your endpoint responds with 200, but it should respond with 101. This could be either server misconfiguration, or a deliberate attempt to prevent third parties from accessing a private API. Or maybe you just did something wrong.

Sorry, I'm closing it as unrelated.

It's clearly not a problem with the package itself, but with the endpoint and/or the way you're trying to connect to it.

The connection through proxy seems to be successfully delivered to the remote host, but it responds with a wrong HTTP code.