How a change reaches readers
Somebody asked for a change, the Gate held it, and a person said yes. Your site is running on your own server, somewhere Loom has never been. This page is the step in between.
There is no deploy in it. No pull request, no merge, no build. The change is live the next time your server asks for it, and your server asks on a timer.
Vaughan & Rill
Bicycles built for one road
Hand-brazed frames, made to measure, delivered anywhere in the country.
See the framesBefore you order
How long does a frame take?
Between nine and fourteen weeks, depending on the finish you choose.
Can I be measured remotely?
Yes. We send a fitting kit and a short video call does the rest — most people never come to the workshop.
Anything else, ask us.
Send a questionEvery one of these goes through the same pipeline a model’s answer would: interpreted, analysed, weighed, judged, applied, appended. The log is real and it is in this tab — reload the page and the example is back as it was.
show the treehide the tree
{
"kind": "element",
"id": "n_readersignals20",
"type": "loom.page",
"props": {
"fills": true,
"width": "readable",
"loom:theme": {
"palette": "minimal",
"fontPack": "minimal-sans",
"stylePreset": "precise"
}
},
"children": [
{
"kind": "element",
"id": "n_readersignals8",
"type": "loom.section",
"props": {
"tone": "surface",
"width": "readable",
"eyebrow": "Vaughan & Rill"
},
"children": [
{
"kind": "slot",
"id": "n_readersignals3",
"name": "heading",
"children": [
{
"kind": "element",
"id": "n_readersignals2",
"type": "loom.heading",
"props": {
"level": 2
},
"children": [
{
"kind": "text",
"id": "n_readersignals1",
"value": "Bicycles built for one road"
}
]
}
]
},
{
"kind": "element",
"id": "n_readersignals5",
"type": "loom.prose",
"props": {
"measured": true
},
"children": [
{
"kind": "text",
"id": "n_readersignals4",
"value": "Hand-brazed frames, made to measure, delivered anywhere in the country."
}
]
},
{
"kind": "element",
"id": "n_readersignals7",
"type": "loom.action",
"props": {
"href": "https://example.com/frames",
"variant": "primary",
"scale": "small"
},
"children": [
{
"kind": "text",
"id": "n_readersignals6",
"value": "See the frames"
}
]
}
]
},
{
"kind": "element",
"id": "n_readersignals19",
"type": "loom.section",
"props": {
"tone": "canvas",
"width": "readable"
},
"children": [
{
"kind": "slot",
"id": "n_readersignals11",
"name": "heading",
"children": [
{
"kind": "element",
"id": "n_readersignals10",
"type": "loom.heading",
"props": {
"level": 2
},
"children": [
{
"kind": "text",
"id": "n_readersignals9",
"value": "Before you order"
}
]
}
]
},
{
"kind": "element",
"id": "n_readersignals14",
"type": "loom.faq-list",
"props": {
"columns": "one",
"width": "readable"
},
"children": [
{
"kind": "element",
"id": "n_readersignals12",
"type": "loom.faq",
"props": {
"question": "How long does a frame take?",
"answer": "Between nine and fourteen weeks, depending on the finish you choose."
},
"children": []
},
{
"kind": "element",
"id": "n_readersignals13",
"type": "loom.faq",
"props": {
"question": "Can I be measured remotely?",
"answer": "Yes. We send a fitting kit and a short video call does the rest — most people never come to the workshop."
},
"children": []
}
]
},
{
"kind": "element",
"id": "n_readersignals16",
"type": "loom.prose",
"props": {
"tone": "muted",
"size": "small"
},
"children": [
{
"kind": "text",
"id": "n_readersignals15",
"value": "Anything else, ask us."
}
]
},
{
"kind": "element",
"id": "n_readersignals18",
"type": "loom.link",
"props": {
"href": "https://example.com/contact",
"tone": "accent"
},
"children": [
{
"kind": "text",
"id": "n_readersignals17",
"value": "Send a question"
}
]
}
]
}
]
}Your server asks, and keeps the answer
Loom is never in the path of a request. If it were, every reader of every page would be waiting on somebody else's network.
So nothing is fetched while a reader waits. One loop, started where your application starts, asks for the project's pages every so often and keeps them in the process:
import { describeSitePullFailure, startPullingLivePages } from "@jam-overture/loom/live"
const live = startPullingLivePages({
deployment: process.env.LOOM_URL ?? "",
key: process.env.LOOM_PROJECT_KEY ?? "",
onOutcome: (outcome) => {
if (outcome.kind === "failed") log.warn(describeSitePullFailure(outcome.failure))
},
})
Two settings and somewhere to put a warning. Here is what one ask brought back while this page was built:
One pull against a door answering this site's own page, every 1m
| What it was | What it is for | |
|---|---|---|
| What was asked | https://loom.example.com/api/pages/live | your deployment's address, with /api/pages/live appended by the client |
| What came back | fresh | one of three words: fresh, unchanged, or failed |
| Pages | 1 | every page the project has published, by id |
| Segment rules | 1 | which readers of which page belong to which segment |
| Segment forms | 1 | the change each segment's readers are served over the base |
| Tag | W/"live-1" | sent back on the next pull, so an unchanged answer costs nothing |
| Drawing on Loom's pages | yes | asked again every 1m |
One call, where you render
Your render path asks one question: what should this person see?
import { describeComposeError, pageForReader } from "@jam-overture/loom/live"
import { renderLoomTree } from "@jam-overture/loom/react"
// whatever this server already knows about the request
const context = { returning: request.cookies.has("seen-us-before"), device: "phone" }
const held = await live.ready()
// Three answers, and you need all three:
// served.tree — what to render. The live page if the loop has one, the
// page your site was built with if it does not.
// served.audience — the segment to count this page view under, where this
// reader is in one. A project defines segments in the portal.
// served.refusal — why a segment's change was not applied, on the rare
// occasions it was not. A line for your log, never a screen.
const served = pageForReader(held, builtTree, context)
if (served.refusal !== undefined) log.warn(describeComposeError(served.refusal))
renderLoomTree(served.tree, { resolver: registry, audience: served.audience })
The comments say what each answer is for. The next two sections are about the last two.
Loom never learns who your readers are
The ask carries your project key and a tag saying what the server already holds. Nothing about any reader goes with it, and there is no field for one.
What comes back is every segment's rules and every segment's change, beside the pages. Sorting this reader, and building the page they get, both happen afterwards, inside your process, against rules already in memory.
That is a deliberate trade: a site downloads more than one reader needs so that no reader is ever the subject of a request to somebody else.
Three readers, one page
One page, one segment: people who have been here before get an extra line at the top.
One page of 2 bands, one segment, and the three answers one call gave
| The reader | What your server knew | What they were served |
|---|---|---|
| Somebody who has been here before | {"returning":true,"device":"phone"} | 3 bands, the form's band first filed under aud_returning |
| Somebody arriving for the first time | {"returning":false,"device":"phone"} | 2 bands filed under everybody |
| A returning reader, after the page moved | {"returning":true,"device":"phone"} | 2 bands filed under everybody aud_returning's delta is against revision 0, the page is at 1 |
The third reader is the one worth a second look. Their segment's change was written against an earlier revision, and the page has since moved past it.
What that reader loses is their segment, not their page. They get the page, counted as everybody's. Counting them as the segment while showing them the plain page would be worse than it sounds: every later comparison between two segments would be a comparison between one segment's real change and another segment's name over the same old page, and the number would look right forever.
A failed pull costs freshness, never the page
This is the property to take away. Every way an ask can go wrong is a kind of answer rather than an exception: the client never throws, because a caller that has to catch has a path on which the page is lost. Each row is a real ask that really failed:
5 pulls, each one really made and really failed — and the reader got the page 5 times out of 5
| What happened | What Loom called it | What the reader got |
|---|---|---|
| nothing was configured to pull from | unconfigured live pages were not pulled (unconfigured): no Loom deployment was configured to pull live pages from | the page no live pages held, so every page renders as it was built |
| the host could not be resolved | unreachable live pages were not pulled (unreachable): could not reach Loom: getaddrinfo ENOTFOUND loom.example.com | the page no live pages held, so every page renders as it was built |
| the door said nothing at all | expired live pages were not pulled (expired): no answer in 5ms | the page no live pages held, so every page renders as it was built |
| the project key was not accepted answered 401 | refused live pages were not pulled (refused): the project key was not accepted: it is not a key this deployment issued, it has been replaced, or it is a publish key | the page no live pages held, so every page renders as it was built |
| the door answered something this version cannot read answered 200 | unreadable live pages were not pulled (unreadable): the answer was not `{ pages: [...], rules: [...], forms: [...], window: {...} }` | the page no live pages held, so every page renders as it was built |
The third row waited 5ms rather than the 10s a deployment waits, so that building this site costs milliseconds. Both numbers are shown because showing one would be this page implying it had waited the other.
A server that was never configured, cannot find Loom, is not answered by it, is turned away, or cannot make sense of the answer serves the site it was built with. There is no broken state to design a screen for.
Only the first reader waits
One reader does wait, once, on purpose: the first person to arrive after your server starts.
Two renders on a server that has just started, and what each one cost the door
| The first render | Every render after it | |
|---|---|---|
| Pulls the door had been asked for | 1 | 1 |
| Waited on the network | once, for the first pull | no |
| Got Loom’s page | yes | yes |
A Loom that says nothing ends that wait after 5s, and the render serves the page as it was built. One pull is given 10s before it is a failure.
They wait so that they get the live page, rather than the old page followed by a different one when they press something. After that, asks happen beside requests and no reader waits on one.
What this does not decide
Where your pages come from and what your server knows about a request are yours. The keys in that context are whatever your rules were written against. What the segments are, and what each one's readers get, is decided in the portal. This page is only the half that runs on your side.