Element-web: Progressive Web App (PWA)

Created on 11 Dec 2019  Â·  13Comments  Â·  Source: vector-im/element-web

Is your suggestion related to a problem? Please describe.
Electron is huge, not to mention problematic in both security and license compliance.

Describe the solution you'd like
By contrast a PWA is just your web app packaged a bit differently so that it can be "installed" on mobile devices and desktops alike. PWA is supported on Chrome and Firefox, Desktop and Mobile.

Using a PWA instead of Electron means the app looks and feels like the Electron app, but it's running in my browser instead, saving me RAM and leaving me with only one runtime (my browser) to keep updated for security fixes.

Describe alternatives you've considered
It's also possible to ask Chrome to "create a shortcut" for the app, and that will let me force the web app to behave more like a PWA, but it's not as friendly and doesn't work on Mobile.

Additional context
I don't think there's additional context needed. Thanks for considering this request!

Community PR suggestion

Most helpful comment

Well happy enough make riot-web installable while its supported / available. Longer term is there any other project thats focused on being a good web client? Not really interested in native apps for chatting

All 13 comments

The main benefit of electron is the ability to run native, optimized code. Which is about to be used for things like end-to-end encrypted search indexing, which is simply not possible to do in a browser efficiently.

I get that. It makes good sense. Personally I'd still rather have the PWA than the Electron app. I imagine there are others who feel similarly.

I'm not suggesting that there _not_ be an Electron app for those who prefer it.

The main benefit of electron is the ability to run native, optimized code

It's a WASM world people!

(seriously though if the browser is new enough to support PWA it will support WASM, don't know riot's e2e code but from experience it should be fairly trivial to get it building unless it does something crazy :-))

Rust to wasm is still inideal, but either way browser doesn't give you a large data store to efficiently use as an encrypted index for events. Riot's olm is already using wasm

New to maxtrix / riot, not sure what the wasm / rust / electron discussion is about, as far as I can tell for riot.im to become an installable pwa, there already seems to be a manifest.json so all thats needed is a service worker right? a simple one could just store the static assets but it doesnt really need to do anything.

Happy to work on contributing one if that sounds good?

the problem is that we are leaning increasingly heavily on native libraries in Riot/Desktop, specifically:

  • Seshat (e2e full text search), which can’t compile to WASM as WASM doesn’t do threads yet
  • Secure elliptic curve key storage in the OS
  • Native crypto primitives (including those you don’t get in WebCrypto - eg curve25519)
  • Native keyboard interaction (for “push to talk voip” a la Discord)

So yes, you could bundle Riot/Web up as a PWA, and we would probably accept a patch that does so. However, it won’t be able to replace Riot/Desktop for the reasons above. Instead, we’ll be gradually migrating to fully native per-platform apps, eventually.

Well happy enough make riot-web installable while its supported / available. Longer term is there any other project thats focused on being a good web client? Not really interested in native apps for chatting

While we are adding a few upcoming features that will initially only be available in the Electron-based desktop build as @ara4n noted above, Riot on the web will remain supported now and in the future. Assuming the web platform adds the APIs we need, we'll work to bring these features to the web version as well.

Both the web and desktop platforms are fully supported and different users have their preferences on which one they'd rather use, so we'll continue to offer both.

https://github.com/vector-im/riot-web/pull/11774 adds a shim service worker, which is the last thing we needed to meet Chrome's PWA requirements. We'll experiment with this style of using Riot and see how it goes.

browser doesn't give you a large data store to efficiently use as an encrypted index for events.

Using IndexedDB you get plenty of room.

  • Firefox has no upper limit besides disk space, if your application wishes to store more than 50MB locally, Firefox will ask the user using a non-modal dialog to confirm that this is okay.
  • Chome: The shared pool can be up to 1/3 of the of available disk space. Each app can have up to 20% of the shared pool. As an example, if the total available disk space is 60 GB, the shared pool is 20 GB, and the app can have up to 4 GB. This is calculated from 20% (up to 4 GB) of 1/3 (up to 20 GB) of the available disk space (60 GB).

IndexedDB doesn't allow for sqlcipher style encrypted at rest without having to do it in the application level to my knowledge.

IndexedDB doesn't allow for sqlcipher style encrypted at rest without having to do it in the application level to my knowledge.

correct. but it does give you the space; so that's a step closer at least.

It wouldn't be efficient as per my original quote. Additionally it'd mean having to implement application level encryption for it all instead of being able to rely on sqlcipher which adds a lot of development time and complexity.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

turt2live picture turt2live  Â·  3Comments

niedzielski picture niedzielski  Â·  3Comments

turt2live picture turt2live  Â·  3Comments

lukebarnard1 picture lukebarnard1  Â·  3Comments

NotAFile picture NotAFile  Â·  3Comments