1fpsvideo / 1fps

1fps.video client app
Other
160 stars 7 forks source link

Feature: do not upload when consumer (viewer) is absent #7

Open ro31337 opened 1 month ago

ro31337 commented 1 month ago

We're currently uploading regardless of anyone's watching it.

Imagine user has whole bunch of tabs, and some of these tabs started to hibernate, and hibernation continues on for days. Some people set up sessions and forget about them, they go to sleep, viewer computers go to sleep.

And then user eventually wants to see the session: comes back to work, or browser tab comes back from hibernation.

We should aim to being frugal and minimalistic when it comes to a resource consumption (network, CPU). It's a good thing for client and server parts. So it would be wise to introduce a ping/pong mechanism. And in case of absent pong for more than a minute we shouldn't be uploading, resizing, wasting resources.

However, immediately after a tab comes back from hibernation, we should keep on uploading again.

Initially (when the app starts), we should just upload assuming we've gotten pong.

The underlying mechanism for that is websocket connection, which we already have for cursor tracking - should we reuse it?