Jump to content

Recommended Posts

Posted (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 by Bagul
  • Like 12
  • Agree 3
Posted

Hi, the client does reconnect, as long as you are actively using the app.

Posted
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?

Posted

This is what happens with a 1-minute timeout.
 

image.png.7fa91fe3e5bee3982c1bbb63c4a238fe.png

Posted

The same thing happens on android tv

 

image.png.518fd061af088b4d2022a382446bfa7e.png

Posted

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.

 image.png.b1b7112be697ebc465111740a4ebde10.pngimage.png.b4612065d6844d07ba5b5ae342cd1f53.pngimage.png.db75aefc809c01a9b1edd5fd4e9c17ce.png

Posted
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.

 image.png.b1b7112be697ebc465111740a4ebde10.pngimage.png.b4612065d6844d07ba5b5ae342cd1f53.pngimage.png.db75aefc809c01a9b1edd5fd4e9c17ce.png

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.

  • Like 4
Cr8iveLosr
Posted

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

Posted

Just for example, Jellyfin send request every 30 seconds to keep alive websocket connection

image.png.49aae37f5a330a0983b956fa5437e97e.png

  • Like 1
  • 3 weeks later...
Posted (edited)

image.png.f3c3a5dc1b5cfd264b4986de850ec9c3.png

 

I'm going up the thread. (And I'm with Caddy so no timeout is set)

Edited by Bagul
Posted

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. 

  • Like 1
  • 2 months later...
  • 1 month later...
  • 2 months later...
  • 3 months later...
adminExitium
Posted

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.

  • Like 1
  • Agree 1
Posted
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.

  • Thanks 1
  • 3 months later...
Cr8iveLosr
Posted (edited)

Any update on this?

Curious if it'll ever see the light of day.

Edited by Cr8iveLosr
Posted
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
Posted
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.

  • Like 1
  • Thanks 1
nanmengong
Posted

+1 This would be usefull.

  • Agree 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...