Topinambur223606 / PixelPlanetTools

Bot for pixelplanet.fun. Partially based on woyken/pixelplanet.fun-bot
35 stars 13 forks source link

Endless reconnect since 2/8/21 #31

Closed JusSumBum closed 3 years ago

JusSumBum commented 3 years ago

Working one second, then not. Not working since then, or about 24 hours now.

with debug turned on:

17:54:30.161 [TECHSTATE] Connecting via websocket... 17:54:30.318 [DEBUG] T1 | Websocket log message: , Not a WebSocket handshake response. 17:54:30.319 [DEBUG] T1 | WebSocket_OnClose(): start 17:54:30.319 [DEBUG] T1 | WebSocket_OnClose(): invoking OnConnectionLost 17:54:30.319 [ERROR] Websocket connection closed, trying to reconnect...

Topinambur223606 commented 3 years ago

I looked at websocket implementation and found following: Headers["User-Agent"] = "websocket-sharp/1.0"; With such header, initiating websocket connection fails with 403 Forbidden status code. Both removing or replacing it with another value allows bot to work as intended. I would prefer replacing it with Chrome 87 user agent because requests with no user agent can be blacklisted as well.

Unfortunately, connecting with such user agent is library internal implementation details. I don't want to move to another library and change whole websocket wrapper implementation, so I'll build library by myself with few changes that allow to pass custom user agent.

Topinambur223606 commented 3 years ago

Please evaluate the fix using the latest build and close the issue if bug is no longer reproducible.

ntomilin commented 3 years ago

Checked. Works fine as supposed to.

JusSumBum commented 3 years ago

Please evaluate the fix using the latest build and close the issue if bug is no longer reproducible.

Looking great. Thx for continuing to support us.