TorrServer icon indicating copy to clipboard operation
TorrServer copied to clipboard

[Feature] Implementation of TS API for paid traffic. Clients (TorrServe\Web) use a large amount of traffic from TorrServer while idle.

Open filimonic opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Please describe. Web UI queries TorrServer for POST /torrents in a second after previous request was completed. TorrServe for Android seems to be acting the same way.

In my case, I have ~500 kb response. It is ~ 30 Mb per minute, or 💥 41 GB 💥 per day! wasted just in idle mode!

Describe the solution you'd like

  1. Add some kind of "paid traffic mode" and light version API when client gets data only if it is updated: 1.1 Send Only necessary info about torrent: do not send any extra data when torrent is "active" like file_stats 1.2 Support ETag or similar way of indicating that response was not changed since previous request 1.3 Make request timeouts larger (30 sec, ex)

  2. Replace requests with notifications over established connection: switch to WebSocket or HTTP LongPolling and send all necessary data only it is needed.

Describe alternatives you've considered No alternatives, just not to forget turn off TV and do not leave WebUI opened.

filimonic avatar May 07 '24 16:05 filimonic

Just as described: if you care about traffic much - don't leave web UI opened or don't store torrents on server, they'll be removed after timeout. In most use cases it's LAN traffic between player and local torrserver. 30 MB per minute is nothing against 1080/4K video played at the same time.

tsynik avatar May 08 '24 07:05 tsynik

In most use cases it's LAN traffic between player and local torrserver. 30 MB per minute is nothing against 1080/4K video played at the same time.

Totally agree, this is because it's FR, not a bug.

filimonic avatar May 08 '24 07:05 filimonic

Also, it's not related to TorrServer directly. You can use any script to communicate with TorrServer or play torrent data. So, it's not a FR for it.

tsynik avatar May 08 '24 07:05 tsynik

Also, it's not related to TorrServer directly. You can use any script to communicate with TorrServer or play torrent data. So, it's not a FR for it.

It is related directly, as it requires implementing new API for TS "ecosystem":

  • TorrServer-WebUI API
  • TorrServer-TorrServe API

filimonic avatar May 08 '24 07:05 filimonic

What about using websockets to prevent client from polling ?

cocool97 avatar May 08 '24 19:05 cocool97

What about using websockets to prevent client from polling ?

IMO:

  1. Websockets are good, but IDK if they work good without TLS on modern software, maybe there is a limitation?
  2. Not all API should be websocket-ized, only torrent list, and maybe cache updates.

filimonic avatar May 08 '24 19:05 filimonic

AFAIK there is no limitation caused by TLS or not, you can use ws for HTTP or wss for HTTPS.

I truly think that this should just be for these endpoints as client polling can be quite verbose

cocool97 avatar May 08 '24 20:05 cocool97