Service Worker possibilities

I was wondering whether wrapping TW5 in a web service worker for use with any http(s) back-end could be useful. It might cope with being intermittently offline without the need for special operating-system specific apps or workarounds.

I cannot claim to be knowledgeable on web service workers, PWAs or any of that and only have a cursory understanding of what they do. I am also aware that mobile operating systems may not behave properly (as if they ever did).

Hi, The purpose of the TW core is to convert TW wikitext into HTML text the can be rendered by the browser.

To achieve that, the core functions have to have access to the browser DOM (Document Object Model)

The main purpose of service workers is, that they are able to prevent data loss, if the client app looses connection to the backend server. But TW is a SPA (single page app). That means it is completely self-contained. That means it can have a server backend, but It does rely on it. That’s by design.

Even if we use TW in a client / server configuration. The server builds a completely independent SPA and sends it to the browser (client). So what you get is still a self-contained SPA.

The main problem with service workers is, that they are not allowed to directly access the DOM.

So the main mechanism, that makes TW work would need to be rewritten, which makes the whole software much more complex, for no real win.

Hope that helps.
Mario

1 Like

Val Packett has already made a PWA version of TiddlyWiki, it works very well !

You can try it here: TiddlyPWA — TiddlyWiki Storage & Sync Solution. To enable sync between devices, you will need to follow the tutorial for glitch (easy and fast, but glitch make the server sleep every so often) or host a deno server yourself. I have made my own tutorial to host a server on a raspberry pi: Setup your own TiddlyPWA server on Raspberry Pi 5 (using cloudflare tunnel)

2 Likes

Does timimi not use a service worker, you install it on your computer and that is how timimi saves to file: addresses. There is a threat to stop timimi due to appstore changes so we need to be across this, I could not live without timimi.

I have noticed that for my single file WebDAV wiki if I’m offline a save simply fails.

My thinking is that with something that knows when connectivity re-appears it could retry the save (possibly from worker storage) and in the case of a node possibly multi-user back-end also fetch any tiddlers changed elsewhere. That’s what I really meant by “wrap”.

My response here tells how the browser storage plugin can help with Tiddlyhost, but it works just as well for WebDAV:

1 Like