threema-web icon indicating copy to clipboard operation
threema-web copied to clipboard

Persistent session across multiple connections

Open lgrahl opened this issue 6 years ago • 24 comments

We have and we always will have issues with Threema Web losing the connection to the app for several reasons:

  1. The app is being suspended,
  2. the network of the browser side changes,
  3. the network of the app side changes, or
  4. (buggy implementations).

While 3. and 4. could potentially be improved by supporting ICE restarts, making the session persistent across multiple connections would be a solution for all four items. It would also allow for dropping the permanent background connection after a period of inactivity without much of an impact which I think is a vital feature Threema Web should have. The only downside is that this will require a major protocol update along with some clever synchronisation.

Improves #60 and #184. Would also greatly benefit from the early data extension plans @dbrgn and I have forged for SaltyRTC.

lgrahl avatar May 19 '18 01:05 lgrahl

Only Android left.

lgrahl avatar Sep 24 '18 21:09 lgrahl

Getting excessively high battery drain on Android 9.0 stable release. Over 20% if I leave it running for most of a workday.

LtPatterson avatar Oct 09 '18 14:10 LtPatterson

@LtPatterson We are aware of general connectivity issues and the associated battery drain. If you want your individual case investigated, please contact the Threema support directly.

lgrahl avatar Oct 09 '18 16:10 lgrahl

Note for us: We should add statistics (number of received chunks, last received chunk timestamps, number of sent chunks, last sent chunk, rx total, tx total, ...) when resolving this for Android.

lgrahl avatar Oct 16 '18 13:10 lgrahl

Any news?

felschr avatar Jan 05 '19 10:01 felschr

Not yet but be assured this is on my top N list of things to resolve.

lgrahl avatar Jan 06 '19 12:01 lgrahl

Another note for us: Make sure to push several times (with some backoff mechanism) in order to improve issues mentioned in #106.

lgrahl avatar Jan 26 '19 22:01 lgrahl

I'm not sure this is the right issue for this comment, but it was the best I could find.

tl;dr: Having an active and an inactive session on the phone (sometimes?) draws insane levels of power. phone gets hot and battery dies in 1h. Also: would be nice if you would consider google-free phones in your fix.

Steps to reproduce: I use threema-web on an AOSP device without google play services, i.e. push notifications not available. This makes session resumption with password cumbersome, its easier to just scan a new barcode than typing the password and starting the session manually. This means, I don't use saved sessions but fairly often start one session, "terminate" it by just closing the browser window/PC going to sleep/whatever. Opening a new session, leads to two sessions in the list on the phone, one of them active. In this state, power consumption (sometimes) is so high that my phone gets hot. I think the abandonned session has an orange wifi-like indicator during these times. It would be awesome, if you could solve all this with something that does not rely on push notifications. Or even better: could you just use a push notification server on your own, which is used if google services are not found? That would also fix the regular app, and replace the polling option.

lbort avatar May 23 '19 14:05 lbort

When this is implemented, it would be interesting to see how much this helps with battery drain. Perhaps Threema can do some analysis and statistics on this. :)

ovalseven8 avatar May 26 '19 15:05 ovalseven8

@lbort Improving non-FCM is on our list. However, I suggest checking out microG.

@ovalseven8 That cannot really be measured since it means moving from a persistent connection to on-demand... which depends on your demand. :slightly_smiling_face:

lgrahl avatar May 27 '19 10:05 lgrahl

Hey @lgrahl,

just wanted to ask cautionly if there is any news about this issue :)

A group of 10 switched from Whatsapp to Threema and four of us just noticed the heavy battery drain when Using Threema Web all day 😅

Hornochs avatar Jan 13 '21 15:01 Hornochs

We're working on something new that will replace Threema Web.

In the meantime, what helps is a stable WiFi connection (less connectivity checks), using Firefox (way less aggressive keep-alive timers) and keeping the phone connected to the PC (or a slow charger) because Android and iOS are less restrictive on background activity when the phone is charging.

lgrahl avatar Jan 13 '21 15:01 lgrahl

Thank you very much for the fast reply!

Okay, I was using it in Franz ... Then I'll switch to Firefox for that, no problem. I already had an stable WiFi Connection. Well, then I have to change my charging behavior 😃

Is there any ETA already when it will be replaced or where I'm able to subscribe for updates?

Hornochs avatar Jan 13 '21 15:01 Hornochs

I can't provide an ETA but you can subscribe to the Threema Channel where any news would certainly be announced.

lgrahl avatar Jan 13 '21 16:01 lgrahl

Hi @lgrahl I noticed what causes the high battery drain, that was not Threema Web alone. As soon as I'm at work and using it the service mdnsd is using quadruble the battery then Threema Web. At Home I don't have this. I guess it's because at work I'm on a different network (Guest WiFi) then my PC using it. 🤔

Hornochs avatar Jan 18 '21 21:01 Hornochs

What are you referring to here? Battery drain on the smartphone or the PC running Threema Web? What kind of system does it run (and what browser, if relevant)?

lgrahl avatar Jan 19 '21 10:01 lgrahl

On the Smartphone and the battery drain.

image

This high drain from mdnsd is only in my office with the different networks. At home it's not nearly as 5% drain.

Hornochs avatar Jan 19 '21 11:01 Hornochs

Very interesting. Can you reproduce this behaviour when WiFi is off?

lgrahl avatar Jan 19 '21 12:01 lgrahl

Very interesting, I just switched to used mAh and see whats happening with WiFi Disabled:

image

While beeing WiFi enabled this happens:

image

Super weird 😅

Hornochs avatar Jan 19 '21 15:01 Hornochs

I have a hunch what this might be. mDNS is used by WebRTC as a privacy measure. I'll see if I can investigate this at some point.

lgrahl avatar Jan 19 '21 18:01 lgrahl

@Hornochs The question now would be: Does the mdns daemon also go berserk when you're not using Threema Web in that network?

lgrahl avatar Jan 20 '21 13:01 lgrahl

@Hornochs The question now would be: Does the mdns daemon also go berserk when you're not using Threema Web in that network?

Thats true, While not using Threema Web mdnsd stays silent.

Hornochs avatar Jan 20 '21 15:01 Hornochs

How's progress going here? There's the new Desktop App which appears to be causing the same battery drain on my Android phone.

HWiese1980 avatar Nov 05 '21 05:11 HWiese1980

Threema Web is in maintenance mode while we are working on a new solution that should resolve some of the long-standing issues we were having with Threema Web, including this one. Threema Desktop 1.x is based on Threema Web, so the same applies to Threema Desktop 1.x.

lgrahl avatar Nov 05 '21 08:11 lgrahl

so what is the state here? It's been two years and with my new Pixel 7a I can't get through the day on my battery charge when using Threema web vs. having 60% left at the end of the day when I don't use it.

I like Threema and pushed my whole family to use it, but this has been a problem for many, many years now and seems to only get worse. If there's no solution for this we'll likely move to Signal

johseg avatar Oct 26 '23 14:10 johseg

The solution is Multi-Device and Threema Desktop 2.0. Development for Android is currently ongoing.

threema-lenny avatar Oct 26 '23 14:10 threema-lenny