Monday, June 27, 2022

WorldWideWeb App

Craig Hockenberry (Hacker News):

About a decade ago, things started to change. Since then it’s gotten harder and harder to start a simple web server for testing HTML, CSS, and JavaScript. I eventually found a way to do it using AppleScript, but as Apple continues to remove open source components from its standard macOS distribution, this workaround isn’t likely to last.

So I decided to write my own web server app.

Alex Guyot:

Solidly developer-focused in scope, the app serves files from a local directory to an automatically generated URL, making these files available to any device on your local network.


WorldWideWeb enables developers to easily open their in-development website on an actual smartphone- or tablet-sized device rather than using a simulator. They can then make changes to their files and simply reload the browser tab to see those changes live.


The story here is quite a bit different for the iPad and iPhone. These devices have previously had no well-known way to achieve the functionality that WorldWideWeb is providing, and certainly not with all the ease and elegance of an app by The Iconfactory. Now, alongside the excellent code editor Runestone (which I covered here last month), WorldWideWeb completes a potential end-to-end pipeline for web development on Apple’s mobile platforms.

I wonder how iOS multitasking treats this. I’ve certainly had problems using VLC’s Web server, because simply tapping a notification or going into Settings puts the app in the background, killing the HTTP connection. I guess that shouldn’t be an issue when serving small files, though, and it doesn’t support PHP or CGI scripts that might run for a while, though the new version does use WebSockets:

Craig Hockenberry:

The main improvement in version 1.0.1 is “auto refresh”. As you edit the text files in your Website Folder, the app watches for changes. When an update is detected, a web socket is used to send a notification to the browser that causes a refresh.

A small bit of JavaScript is injected into every HTML page to make this happen, and the feature can be disabled if that causes a problem.


Update (2022-06-30): WorldWideWeb plays audio in the background in order to keep the network connection alive.


3 Comments RSS · Twitter

When an app is backgrounded, an IP socket is frozen first (and can survive some reopens if done quickly enough), but will later get reclaimed - a problem is that the latter is not easy to detect.
To be on the safe side, you have to unbind the server when the app backgrounds, and bring it up again when the app becomes active again. (unless it is running in a VPN extension or is bound using AF_LOCAL sockets).
Also, for reasons, you should really use Network.fw on iOS, which this isn't.

When the app is in the background, it plays a periodic tone (using the "audio" UIBackgroundMode). This keeps the socket alive enough to serve content.

I really wanted to like this, but the response size is limited to less than 1 GB. So I'm back to quick hacks with sh and netcat.

Leave a Comment