Features

Live updates and offline

How pages update as things change, why lists don't jump, and how the app keeps working without a connection.

Hubstruct's pages update by themselves. When a thumbnail is made, a tag applied, a face found or an album refreshed, every open page showing it updates within about a second, with no reloading. And because your library is kept in your browser too, pages open at once, and still open when the server can't be reached.

Your library, in your browser

The first time you open a library in a browser, Hubstruct brings its lists into that browser: its media (not the files themselves, just what lists show of them), tags, albums, people and groups. A library of ten thousand media takes a few seconds and around ten megabytes. After that:

  • Pages open at once. The media page, an album, a tag, a person, Home's rows: worked out in the browser, the same way the server would, sorted and filtered however you like.
  • Only what changed comes over. When something changes, the server says so, and the browser asks for what's changed since it last looked, never the whole library again.
  • Each library on its own. A tab in one library is never stirred by work going on in another.
  • Each person their own. Signing out removes everything Hubstruct kept in that browser.

Searching (by words, meaning or look) still asks the server, which knows what everything means; the results then follow your library as it changes, like any list.

How it works

  1. The database writes down every change as it happens, whoever made it: the API or the worker.
  2. The API passes a short note to every open browser (a poke, over a live stream of Server-Sent Events): "this library changed".
  3. A browser with that library open asks for what changed since it last asked, and gets just those rows.
  4. Each page shows what it shows from the browser's copy, and changes when that does.

One stream serves every tab of a browser: the tabs pick one of them to hold it and pass the news on, so a dozen open tabs still use one connection.

There's no polling. When the connection drops, nothing is asked for; when it's back, the browser catches up on everything it missed in one go.

Lists don't jump

A list that rearranged itself every time something arrived would be impossible to use, so Hubstruct doesn't do that:

  • Something changes (a thumbnail arrives, a tag is added, a title is written): it changes where it is.
  • Something new joins the list (an upload, a rule): the list stays still and a New button appears at the top, with how many. Click it to show them.
  • Something leaves the list (moved to the trash, taken out of the album, untagged elsewhere): it stays where it was, dimmed and marked, until the list is shown afresh.

What you do yourself shows at once, though: unheart something in your favorites and it leaves the list.

Without a connection

If the server goes away (a restart, an update, the network), Hubstruct keeps working with what your browser has:

  • every list, sorted and filtered as you like, from your library as your browser last saw it;
  • the pages you've opened before, as you last saw them, with their pictures;
  • what you've kept offline, below;
  • hearts, NSFW answers and tags you change meanwhile: shown at once, and sent when the server's back.

The status bar says when you're offline, how fresh your copy is, and how many changes are waiting to be sent. Things that need the server (searching by meaning, uploads, processing) wait for it.

Installed as an app, Hubstruct opens even when the server itself is down, straight into your library as your browser has it.

Keep offline

Lists are always there offline, but pictures and media pages only once you've seen them. To make sure, right-click an album or a media (or use its ⋯ menu) and choose Keep offline: its pictures and pages are kept in this browser until you choose Don't keep offline. An album kept offline keeps whatever joins it later too. Videos play only with a connection.

A new version of the app

When Hubstruct is updated, open pages notice when they reconnect, or when you come back to the tab, and show A new version of Hubstruct is ready, with Reload. Nothing reloads by itself, so you never lose what you were doing.

The status bar

A thin bar along the bottom of the app shows how fresh what you're seeing is, and, at the left, when you're offline or your library is still coming into this browser. To see how the processing is going, open the Dashboard.