5 min read

Progressive Web Apps are already being deployed at a massive scale evidenced by their presence on most websites now. But what’s next for PWA? Alex Kehayis, developer at Stripe things its the merging of WebAssembly to PWA. According to him, the adoption of WebAssembly and ease of distribution on the web creates compelling new opportunities for application development. He has created what he calls Progressive Webassembly Applications (PWAAs) which is built entirely using Rust. In his talk at WebAssembly San Francisco Meetup, Alex walks through the creation of Woz, a PWA toolchain for Rust. Woz is a progressive WebAssembly app generator (PWAA) for Rust. Woz makes distributing your app as simple as sharing a hyperlink.

Read Also: Fastly CTO Tyler McMullen on Lucet and the future of WebAssembly and Rust [Interview]

Web content has become efficient

Alex begins his talk by pointing out how web content has become massively efficient; this is because it solves three problems:

Distribution: Actually serving content to your users

Unification: Write once and run it everywhere

Experience: Consume content in a low friction environment

Mobile applications vs Web applications

Applications are kind of an elevated form of content. They tend to be more experiential, dynamic, and interactive. Alex points out the definition of ‘application’ from Wikipedia, which states that applications are software that is designed to perform a group of coordinated functions tasks and activities for the benefit of users. Despite all progress, mobile apps are still hugely inefficient to create, distribute, and use.

Its distribution is generally in the hands of the duopoly, Apple and Google. The unification is generally handled through third-party frameworks such as React Native, or Xamarin. User experience on mobile apps, although performant leads to high friction as a user has to generally switch between apps, take time for it to install, load etc.

Web based applications on the other hand are quite efficient to create, distribute and use. Anybody who’s got an internet connection and a browser can go through the web application. For web applications, unification happens through standards, unlike frameworks which is more efficient. User experience is also quite dynamic and fast; you jump right into it and don’t have to necessarily install anything.

Should everybody just use web apps instead of mobile apps?

Although mobile applications are a bit inefficient, they bring certain features:

Native application has better performance than web based apps

Encapsulation (e.g. home screen, self-contained experience)

Mobile apps are offline by default

Mobile apps use Hardware/sensors

Native apps typically consume less battery than web apps

In order to get the best of both worlds, Alex suggests the following steps:

Bring web applications to mobile

This has already been implemented and are called Progressive web applications Improve the state of performance and providing access.

Alex says that WebAssembly is a viable choice for achieving this. WebAssembly is highly performant when it’s paired with a language like Rust. Progressive WebAssembly Applications

Woz, a Progressive WebAssembly Application generator

Alex proceeds to talk about Woz, which is a progressive WebAssembly application generator. It combines all the good things of a PWA and WebAssembly and works as a toolchain for building and deploying performant mobile apps with Rust. You can distribute your app as simply as sharing a hyperlink. Woz brings distribution via browsers, unification via web standards, and experience via hyperlinks.

Woz uses wasm-bindgen to generate the interop calls between WebAssembly and JavaScript. This allows you to write the entire application in Rust—including rendering to the DOM. It will soon be coming with ‘managed charging’ for your apps and even provide multiple copies your users can share all with a hyperlink.

Unlike all the things you need for a PWA (SSL certificate, PWA Manifest, Splash screen, Home screen icons, Service worker), PWAAs requires JS bindings to WebAssembly and to fetch, compile, and run wasm.

His talks also talked about some popular Rust-based frontend frameworks

Yew: “Yew is a modern Rust framework inspired by Elm and React for creating multi-threaded frontend apps with WebAssembly.”

Sauron: “Sauron is an html web framework for building web-apps. It is heavily inspired by elm.”

Percy: “A modular toolkit for building isomorphic web apps with Rust + WebAssembly”

Seed: “A Rust framework for creating web apps”

Read Also: “Rust is the future of systems programming, C is the new Assembly”: Intel principal engineer Josh Triplett

With Woz, the goal, Alex says, was to stay in Rust and create a PWA that can be installed to your home screen. The sample app that he created only weighs about 300Kb.

Alex says, “In order to actually write the app, you really only need one entry point – it’s a public method render that’s decorated wasm_bindgen. The rest will kind of figure itself out. You don’t necessarily need to go create your own JavaScript file.” He then proceeded to show a quick demo of what it looks like.

What’s next?

WebAssembly will continue to evolve.

More languages and ecosystem can target WebAssembly.

Progressive web apps will continue to evolve.

PWAAs are an interesting proposition. We should really be liberating mobile apps and bringing them to the web. I think web assembly is kind of a missing link to some of these things.

Watch Alex Kehayis’s full talk on YouTube. Slides are available here.

Other news in Tech

Wasmer’s first Postgres extension to run WebAssembly is here!

Mozilla proposes WebAssembly Interface Types to enable language interoperability

Wasmer introduces WebAssembly Interfaces for validating the imports and exports of a Wasm module