Jump to content

Websocket Timeout


Bagul

Recommended Posts

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 8
  • Agree 3
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Cr8iveLosr

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

Link to comment
Share on other sites

  • 3 weeks later...
sross44

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
Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

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