-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Websocket does not reconnect after Jellyfin server restart #797
Comments
I am having the same problem, my jellyfin instance is running in a docker. When I update / reboot it, the websocket connection seems to not be reestablished. I noticed it by two things:
System (please complete the following information):
|
Noticing the same on my setup too having moved from PKC to Jellyfin. I don't keep my server powered on overnight and then notice that all my clients are disconnected until Kodi is restarted etc. PKC did seem to react quite well with Plex been offline & then re-establishing the connectivity etc. Hopefully its a minor change that will make a big improvement if this can be sorted. |
I've created a PR which fixed this in my setup. After reconnecting the websocket a small delay is needed before the client capabilities are registered or the session ends up in a state where it is does not report as use controllable and doesn't appear in the play on dialog. Tested through different reconnect scenarios, client reappears in Play On and play status sync resumes. |
Thanks so much for taking a look at a resolution for this. Is it sufficient to just edit the files manually that you changed or does other work need doing? Only ask as I tried editing the files manually on my setup & tried it on a client and it appeared to make no difference. |
You'll need to restart Kodi to reconnect using the new client options. If it does not reconnect can you enable debug mode in the addon and submit the log of an interrupted connection. |
Yeah I immediately restarted after making the changes to the files. I'll look at doing debug mode tomorrow and submitting that. Assuming debug just gets output to the main kodi.log file? Cheers |
OK so from looking at two of my clients, it seems that if the connection is disrupted from the server side (I.E service stopped) when that comes back up connectivity comes back fine:
But if the connectivity was disrupted on the client side, I.E by me dropping the Wi-Fi connection, then something seems to go awry, I knocked the connection offline at about 10:24 but do not see a "connection reset by peer" like before, several minutes later Jellyfin does appear to make a connection again to the server, but no sync data comes through, and the client does not show back up in the "Play On" via my Android App:
|
Your log shows the websocket is reconnected but the API call to register the capabilities fails with Can you try increasing the |
OK so I increased this to 60 seconds and tested again, this has improved somewhat as I now see the device in my Play To section on the Android App. However nothing works still from syncing the play progress perspective and this does not update/change.
|
From your comments are you making changes to watch/play state with the client offline and they are not syncing on reconnect? If after you reconnect you mark an item is watched does that come through? i.e. does the reconnect and subsequent sync work? I tested blocking my client, updating a watch status on the server and unblocking 10 minutes later, the status event came through within 60 seconds of being unblocked. This looks to be handled by the websocket If I do the above and also tcpkill the socket I can reproduce the problem, the client is online and gets changes going forward but not anything that occurred while disconnected. Perhaps the client needs to request a full or partial (Via Kodi sync queue) library update on reconnect which is currently done on plugin startup. I could look at triggering a sync for changes on reconnect. Doing a full sync feels too much and may have negative impact on clients that reconnect frequently for whatever reason. |
Offline sync of playback / re-sync after reconnect sound like separate pullrequest(s) to the one in question here
…On 4 February 2024 23.22.50 CET, smcmnz ***@***.***> wrote:
From your comments are you making changes to watch/play state with the client offline and they are not syncing on reconnect? If after you reconnect you mark an item is watched does that come through? i.e. does the reconnect and subsequent sync work?
I tested blocking my client, updating a watch status on the server and unblocking 10 minutes later, the status event came through within 60 seconds of being unblocked. This looks to be handled by the websocket `reconnect` param. I didn't get a `websocket opened` message. I guess the change events were buffered by the server.
If I do the above and also tcpkill the socket I can reproduce the problem, the client is online and gets changes going forward but not anything that occurred while disconnected. Perhaps the client needs to request a full or partial (Via Kodi sync queue) library update on reconnect which is currently done on plugin startup.
I could look at triggering a sync for changes on reconnect. Doing a full sync feels too much and may have negative impact on clients that reconnect frequently for whatever reason.
--
Reply to this email directly or view it on GitHub:
#797 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
Sounds similar to #627
I got 3 LibreElec on RPI4/5 (2 with LE 11.0.3 official and 1 with nightly for RPI5)
All 3 working just fine , data is synced using the web sockets and with kodi sync after some down time.
When restarting Jellyfin server , no client is re-connecting using websocket , i can easily verify this by Jellyfin's web GUI (devices not shown as cast target).
At first i thought i need to wait few minutes , but it never reconnects , only restarting kodi or the addon makes the client re-connect the websocket.
To Reproduce
Expected behavior
Clients should re-connect after reasonable interval. (few minutes)
System (please complete the following information):
The text was updated successfully, but these errors were encountered: