Comment by r3trohack3r

2 years ago

This is actually a bummer.

P2P mobile applications cannot wake themselves up to sync with peers (short of relying on exploits).

The same is true of browser service workers.

The architectures I’ve explored for mobile and web based P2P apps, they’ve all needed a central trusted push notification server fallback to wake up the process so it can check for messages.

Even then the APIs will fight you.

Unless the fallback server syncs for you, it can only wake you up on an interval. It can’t know if there is a notification worthy event for you to sync.

If you wake up the process and there are no messages from its peers that generate a notification, you “consume” some of your background notification budget.

Consume too much and the system stops waking your app on push events, so you stop syncing in the background.