Last updated: 23 June, 2015
With all the talk about asm.js and web assembly, I want to write up the way I'd like to try doing a web app: well, the short is "don't", but we do want to get the benefits of it.
So, what are the benefits of web apps? Let's see:
- Ease of deployment
- Sandbox security
- Simple (ish) to write
- Hyperlinking
- Ease of updating
- Cross-platform VM
- More?
I think those are the important ones, and I think we can do it with a small combination of existing technologies: we pack a small Linux VM with the browser and have it communicate with the system through an X server, also packed with the browser. (Perhaps with some X extensions for things like link clicks and audio.)
A hyperlink has a URL to a downloadable program and its arguments, probably with a new scheme, like app://yourdomain.com/app_name?app_arguments. The app is a directory on the server consisting of the binaries, the assets it needs, and a manifest file that defines it. The browser downloads it and runs it inside a VM or Linux container or something similar (perhaps a container inside a VM) and runs it.
You can define different binaries for different hardware platforms, e.g. one for x86 and one for ARM, and the manifest lists its dependencies as other URLs. The browser becomes a bit of a package manager and binary patcher to efficiently handle shared bits and updates. The user doesn't need to realize things are downloaded and cached, like how they can kinda ignore it with Javascript now.
The VM runs a very minimal Linux system - it isn't intended for human operators to actually log into, it just provides a consistent and convenient target for the application developers. While some new development tools may be written for easy app deployment, with a standard Linux target, I want regular compilers to just work. Take the language you like with the libraries you like and just use them, as long as they can make Linux programs.
That's similarly my goal with X: there's existing X servers for operating systems and plenty of libraries. It can pop up windows with decent integration with the native system (not very good, really, but neither is the web browser and at least X gives us drawing and such and taskbar buttons). I don't really like X, it kinda sucks, but it has existing stuff we can use.
The X windows won't necessarily go the system either btw, you might be trapped inside a browser tab, running something similar to Xnest, so your popup windows don't annoy the user too much. This may be user-configurable.
The major extension is an open-hyperlink command. This feeds a URL into the browser which handles it as if the user clicked it on a traditional web page. Standards already exist to do this too! But it doesn't stay inside the vm, it goes back to the browser core to open a new tab or whatever.
Inside the VM, the app is presented with a bit of a filesystem and networking. The container limits its file size and access according to browser dev/user requirements, and also restricts network traffic back to the home server using a kernel firewall. The protocols used, as long as they get through that, can be whatever.
If the deployment bits in the browser work out, this should give us a bigger benefit for web apps than any of the asm.js stuff. I'm kinda reminded of Java's early promise, but we don't even need a separate JVM, we can just use hardware virtualization for maximum speed - and reuse of existing developer tools.
This does NOT integrate with traditional webpages, except through hyperlinks. It makes no attempt at DOM access or html uis; it is an app delivery and sandboxing system, not another layer of html cruft. It also does not necessarily work as a thin client, since the program is downloaded to the user's computer. (It might be a thin client, but might not be too, these programs can at least run again while offline.)
Basically, I want a consistent platform to turn the web into a new distributed app store.