URLSession and GZip

Another short entry, just to make a search engine indexable note about something I’ve discovered. It appears that when using URLSession in iOS, there is no way to stop the OS from decompression gzipped content. Normally you’d want it to do this, but in my case I would actually prefer to preserve the gzipped body on disk. Worse, having the gunzipped body means that the Content-Length header is no longer accurate, and when you’re using SQLite 3’s blob streaming functions (which I am, more on that later) you need to know the length upfront.

Read More

URLSession, willPerformHTTPRedirection and timeouts

Erk. It’s been a month since I started this thing and I haven’t updated it in a while. I’ve been busy on other stuff at the lab, but have been plugging away at bits and pieces when I can find the time. Lately, I’ve been trying to replicate the Fetch API in iOS. The first hacky version kind of sidestepped the details of the API and just downloaded whole files into memory, but we want to be a little smarter than that, since we might be downloading multi-megabyte files into our cache, or something like that.

Read More

UNNotificationServiceExtension and memory

As previously noted, my hacky attempt at making a service worker implementation really came undone when it tried to handle push messages. UNNotificationServiceExtension has a hard memory limit, and if your code hits that limit it’ll immediately terminate the process without letting you change the content of a notification. Not great.

Read More

importScripts()

Issue number one. I totally ignored importScripts() functionality when first hacking around with this because it didn’t seem necessary, but if I want to end up with something spec-compliant, it’s pretty crucial (the Google SW toolbox uses it, for one). importScripts is weird. But after reading the spec and a number of GitHub comments I think I’ve nailed the functionality down. This is how I’m going to implement it, anyway…

Read More

A development blog.

Hello. I’m trying a new thing here, a semi-regular blog detailing the work I’m doing on a specific project. Namely, Hybrid, my attempt at implementing Service Workers inside an iOS app. Normally we write up all our Lab projects on Medium, but waiting until I’m finished before detailing everything isn’t going to work here - there’s just too much going on.

Read More