-
-
Notifications
You must be signed in to change notification settings - Fork 620
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
Fix websocket reconnect logic #242
Conversation
Codecov Report
@@ Coverage Diff @@
## master #242 +/- ##
=======================================
Coverage 90.87% 90.87%
=======================================
Files 43 43
Lines 1677 1677
=======================================
Hits 1524 1524
Misses 82 82
Partials 71 71 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @quthla, thanks for your contribution!
It's a good catch but i don't think this code is obsolete. There are some miss configurations in which the web socket could be closed without having errors on any HTTP request. An example would be a wrongly configured reverse proxy which has a really small read/write/connection timeout. (see proxy_*_timeout
settings in https://gotify.net/docs/nginx) In this case, the web socket would be closed without any reconnect.
Could we fix the existing implementation that we still do the reconnect and show the error message?
It will still call tryAuthenticate on close which fires the reconnect logic so that's not an issue and the code is not needed anymore |
Are you sure? I think the reconnect logic (CurrentUser.connectionError) will only be executed if there was an error the first place (tryAuthenticate() will resolve successfully). In this case, only the web socket closed the rest of the state doesn't know of this and still thinks everything is fine. |
We can of course also keep the code. |
It's not an obvious error, normal users doesn't look in the console for errors, so we don't know how frequent the bug occurs. |
Well, if you want to keep it, then that's ok with me. After all, you know the backend and how all is tied together better than me. I've restored and fixed the old code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thank you!
Can you make a new release? Maybe gotify will then finally reliably reconnect for me 😂 |
Do you use a reverse proxy? Gotify only closes the websocket connection if the user/client gets deleted, every other close should not happen. |
I think it's more of a network issue which rarely occurs but yes I'm using a reverse proxy. Checked my proxy's error logs but nothing there |
Could you check the gotify log if there is something regarding websockets? Otherwise, it's most likely the fault of the reverse proxy. But, I'll create a new release after fixing #243 |
No results grepping for websocket. Grepping error yields a few hundred lines like the following
|
That seems normal, I'll add some better error messages for websockets. With d764a8d messages like |
@quthla v2.0.12 is released https://github.com/gotify/server/releases/tag/v2.0.12 |
|
@quthla Could you open a new issue for this and don't forget to include your nginx config. |
I'm using Apache. So you suspect this to be an issue with gotify or why should I open a new issue? |
Most likely not, but without the config I can't say it for sure. I don't want to discuss this issue in a pull request, therefore you've to create a new issue for it. |
The code is obsolete now that there is the improved auto reconnect function
It also did never actually work anyway. This will call
listen
with an undefined callback, thus leading to the following error and effectively preventing the client from reconnecting automatically.TypeError: e is not a function WebSocketStore.ts:33:33