Bagul 177 Posted October 20, 2023 Posted October 20, 2023 (edited) Hello, Is it possible that in a version of emby a "ping pong" is performed in websocket to maintain a connection via a reverse proxy? Let me explain. Apart from reverse proxies such as caddy or traefik (for those I know) there is no real timeout for websockets. For reverse proxies like haproxy or nginx, the timeout is defined either by default or by the user. In the case of haproxy or nginx, if someone pauses a video that lasts more than an hour (a movie, for example), the websocket timeout will occur before the end of the movie. Or if, when playing an episode of a series lasting 40 minutes, the viewer pauses the video for 20 minutes, the connection will be closed before the end of the episode. Having the client send a message and the server reply every X seconds/minutes would eliminate the problem and prevent the connection from staying open for 1 hour for no reason, as in the nginx configuration. Also, I saw a message saying that if a connection was closed unexpectedly, for resource reasons, there was no attempt to reconnect. Why not set up a number of reconnection attempts? For example, the client tries to reconnect 3 times, and if none of the attempts work, the connection is aborted. This would, I think, allow better websockets management and avoid connections being open for hours. Or even when changing networks (LTE->wifi or wifi->LTE), this would make it easier to re-establish the connection than quitting the application and reopening it. To avoid sending just a "ping" and a "pong", useful information can be sent through websockets when the client supports them, such as the position of the video playback (which is currently sent via http), because a request via websocket is faster than an http request and sends, with the same information in the body, less data than an http request. Edited October 20, 2023 by Bagul 12 3
Luke 38971 Posted October 20, 2023 Posted October 20, 2023 Hi, the client does reconnect, as long as you are actively using the app.
Bagul 177 Posted October 20, 2023 Author Posted October 20, 2023 9 minutes ago, Luke said: Hi, the client does reconnect, as long as you are actively using the app. The client reconnects when the application is navigated. Does it reconnect during video playback? And if a client reconnects, this uses more resources and is slower than keeping the connection open, isn't it?
Bagul 177 Posted October 21, 2023 Author Posted October 21, 2023 This is what happens with a 1-minute timeout.
Bagul 177 Posted October 21, 2023 Author Posted October 21, 2023 The same thing happens on android tv
SShzin 4 Posted October 21, 2023 Posted October 21, 2023 Also seeing a similar issue, which does not allow the admin to stop the stream. This is happening quite often and with no way to "kill" the stream, I have to go into the user settings, and disable and re enable to stop it. There is no option to stop or pause after a short period of time. One of these started playing and within a couple minutes into it, the option to stop or pause disappears. A photo of how it should look at all times is included.
Bagul 177 Posted October 21, 2023 Author Posted October 21, 2023 3 minutes ago, SShzin said: Also seeing a similar issue, which does not allow the admin to stop the stream. This is happening quite often and with no way to "kill" the stream, I have to go into the user settings, and disable and re enable to stop it. There is no option to stop or pause after a short period of time. One of these started playing and within a couple minutes into it, the option to stop or pause disappears. A photo of how it should look at all times is included. You can modify the timeout in your reverse proxy configuration and increase it to limit websocket disconnection (if your reverse proxy accepts websockets). The purpose of this FR is to apply Emby's own websocket management to prevent connections from being open for 1 hour or more on the various reverse proxies. 4
Cr8iveLosr 60 Posted October 26, 2023 Posted October 26, 2023 100% keeping an eye on this thread, that will be ignored or fall into developmental hell for decades thanks for the well thought out idea and posting the FR. repped
Bagul 177 Posted October 27, 2023 Author Posted October 27, 2023 Just for example, Jellyfin send request every 30 seconds to keep alive websocket connection 1
Bagul 177 Posted November 18, 2023 Author Posted November 18, 2023 (edited) I'm going up the thread. (And I'm with Caddy so no timeout is set) Edited November 18, 2023 by Bagul
sross44 318 Posted November 20, 2023 Posted November 20, 2023 This would be insanely helpful actually. I travel often for work and am constantly connecting to my server remotely which I have setup behind Nginx. Great and well flushed out idea. 1
adminExitium 261 Posted September 26, 2024 Posted September 26, 2024 Just a minor nit, the topic should probably be renamed to Websocket Keepalive because that's the actual FR, and the timeout is the issue. 1 1
seanbuff 1029 Posted September 26, 2024 Posted September 26, 2024 3 minutes ago, adminExitium said: Just a minor nit, the topic should probably be renamed to Websocket Keepalive because that's the actual FR, and the timeout is the issue. Agree, done. 1
Cr8iveLosr 60 Posted January 10 Posted January 10 (edited) Any update on this? Curious if it'll ever see the light of day. Edited January 10 by Cr8iveLosr
Luke 38971 Posted January 10 Posted January 10 23 minutes ago, Cr8iveLosr said: Any update on this? Curious if it'll ever see the light of day. Hi, what are you hoping to accomplish?
Cr8iveLosr 60 Posted January 10 Posted January 10 12 minutes ago, Luke said: Hi, what are you hoping to accomplish? I'm unsure how to make the OP anymore clear. But if it needs to be summarized again due to age of the request. The OP is imploring much needed improvements to WebSocket connections in Emby by implementing keepalives to maintain the connection during pauses in video playback, such as when watching movies or TV shows. This would prevent timeouts that cause the connection to close prematurely and prevent playback controls from being displayed or used in event the admin wants kill user session(s) for various reasons. Several examples have been provided in previous discussions to illustrate this need. 1 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now