Open TitanNano opened 6 years ago
@zhukov
from /app/js/lib/push_worker.js#L22-L34 it apears that lastAliveTime
is not used anymore. Therefor I suggest to remove it and the client to service-worker ping completely.
To resolve the initial issue it would be in this case best to notify the active client about the push and reactivate the long-poll. /app/js/lib/mtproto.js#L730-L736 already exists but is never used.
Is this the reason for the notification popups to appear even if I close the tab with Webogram?
@TitanNano indeed. thanks for the research.
@azzimuth hmm.. is wording correct? notification popups appear when tab is closed due to Push API support.
@zhukov I was just guessing.
When the app is idle on mobile, the long-poll is put to sleep. At the same time though the ping from an open client to the service worker keeps going. This creates a situation in which the service worker ignores pushes because it thinks there is an active client, and the client is disconnected because it stopped long polling.
It would be best to also suspend the ping to the service worker when the app is idle. This way the open client is ignored until it's used again. This would help keeping battery usage down.