-
-
Notifications
You must be signed in to change notification settings - Fork 114
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 automatic reconnection #812
Conversation
@@ -65,4 +65,4 @@ dependencies: | |||
- addon: 'script.module.addon.signals' | |||
version: '0.0.5+matrix.1' | |||
- addon: 'script.module.websocket' | |||
version: '0.58.0+matrix.1' | |||
version: '1.6.4' |
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.
Have you verified that this version of the websocket library actually exists in the Kodi repositories for the supported versions?
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.
Yes this version is available for Matrix, Nexus and Omega
@@ -62,23 +61,18 @@ def run(self): | |||
|
|||
while not self.stop: | |||
|
|||
time.sleep(self.retry_count * 5) | |||
self.wsc.run_forever(ping_interval=10) | |||
self.wsc.run_forever(ping_interval=10, reconnect=10) |
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.
Looks like the main functional change in this PR is the addition of the reconnect parameter here.
Could you elaborate on the reasoning behind removing the back-off delay?
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.
The reconnect param makes the reconnect logic handled by the websocket library. I added logging to the backoff delay and found it wasn't getting called anymore so I removed it for clarity.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #812 +/- ##
==========================================
+ Coverage 21.50% 21.52% +0.02%
==========================================
Files 63 63
Lines 8546 8537 -9
Branches 1572 1571 -1
==========================================
Hits 1838 1838
+ Misses 6684 6675 -9
Partials 24 24 ☔ View full report in Codecov by Sentry. |
Is there something we can do to push this fix fwd? |
Quality Gate passedIssues Measures |
Just discovered Jellyfin (moving away from Plex) and this little issue is driving me crazy :) |
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.
From a quick test it works after restarting my server. The old method did too, but this picked it up faster
Changes the reconnection approach to use the reconnect function of the websocket-client library. The current approach throws an error but does not reconnect.
After reconnection a small delay was needed before the session capabilities are registered otherwise the client will not appear as user controllable.
Resolves #797