Record the owner's acceptance of the ntfy plan
The owner accepted every proposed default of docs/plans/ntfy.md on 2026-12-01, keeping WebSockets first. Its open questions become numbered decisions, without the alternatives, and design.md's Planned next item 6 records them. The plan's acceptance edits are made: design.md gives the conditions under which ntfy replays a topic's whole history for a message ID; formatters.md's phase 5 loses its publish endpoint item, since there is none; templates.md's findings lose the open point on that endpoint. formatters.md is not yet folded into design.md: printers.md and job-store.md, not yet accepted, still plan edits to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5c629b257
commit
b06f2d8d65
4 files changed
+94
-104
No files matched your search
+32
-12
@@ -315,11 +315,13 @@ client ─HTTPS─▶ Caddy ─▶ server ── validate ──▶ printqueue (
|
||||
stop reading (TCP backpressure) while the print queue is full, and
|
||||
every timer (reconnect, stall, retry, digest, save) is one deadline
|
||||
in it.
|
||||
- The cursor is ntfy server time, never `since=<id>`: an unknown or
|
||||
expired ID makes ntfy replay the topic's whole history. ntfy sends
|
||||
`open` before the replay, so only a keepalive or a dealt-with message
|
||||
moves the cursor, except on a first start without `since`, where
|
||||
nothing is replayed and `open`'s time is safe. ntfy dates a message
|
||||
- The cursor is ntfy server time, never `since=<id>`: an ID ntfy does
|
||||
not know, expired or not yet stored on the node asked, makes ntfy
|
||||
replay the topic's whole history, unless that node delivered it in
|
||||
the last two minutes. ntfy sends `open` before the replay, so only a
|
||||
keepalive or a dealt-with message moves the cursor, except on a first
|
||||
start without `since`, where nothing is replayed and `open`'s time is
|
||||
safe. ntfy dates a message
|
||||
before it stores its attachment, so one can arrive after others dated
|
||||
later; a reconnect therefore asks for two minutes before the cursor.
|
||||
The IDs of the messages a replay could send again, those dated at or
|
||||
@@ -544,19 +546,37 @@ not yet written is described here until it is.
|
||||
raw body first. A repeated delivery gets its first answer, and a
|
||||
template that fails prints a fallback receipt.
|
||||
- Templates do not need the `group` block.
|
||||
6. **ntfy**: `docs/plans/ntfy.md` (written; its open questions await the
|
||||
owner).
|
||||
6. **ntfy**: `docs/plans/ntfy.md` (written; the owner accepted every
|
||||
proposed default, 2026-12-01).
|
||||
- The subscriber prefers ntfy's WebSocket endpoint (`/<topics>/ws`),
|
||||
falls back to the JSON stream, and the transport is chosen per
|
||||
subscription in the config.
|
||||
subscription in the config: `transport` is `auto` (the default),
|
||||
`websocket` or `json`. The owner keeps WebSockets first, although
|
||||
behind Caddy the JSON stream does as well or better.
|
||||
- `auto` falls back when the WebSocket itself is refused, such as by a
|
||||
proxy that drops the upgrade, not on ordinary failures, and tries it
|
||||
again on the first reconnect an hour later. `/healthz` shows each
|
||||
subscription's transport.
|
||||
- A WebSocket answers ntfy's pings, which reset the stall timer and
|
||||
never move the cursor, and learns the server's clock from `open`
|
||||
alone. The client is fasthttp/websocket's, as for the remote agents,
|
||||
with the token in the `Authorization` header, never in `?auth=`.
|
||||
- On a connection that asked for a replay, no message moves the cursor
|
||||
until the first keepalive, so a message that arrives during a replay
|
||||
cannot skip its rest. A WebSocket has no keepalives, so its cursor
|
||||
stays put for the connection, and the floor follows `max_backlog`
|
||||
while connected, which bounds the next replay and the saved IDs.
|
||||
- It handles ntfy's replay limits: `X-Messages-Truncated: 1` on a
|
||||
replay cut at 10 MB, and `429` with error code `42905` when the daily
|
||||
bandwidth budget is spent.
|
||||
- Resuming by `since=<message ID>` is checked in ntfy's source first,
|
||||
including what ntfy does once that ID has expired from its cache.
|
||||
bandwidth budget is spent. ntfy 2.38.3 sends both on polls only, so
|
||||
the stream keeps its replay; a cut replay is logged, `42905` is
|
||||
named in `last_error`, and an error ntfy writes into a stream ends
|
||||
the connection and prints nothing.
|
||||
- The cursor stays a server time, never `since=<message ID>`, as
|
||||
checked in ntfy's source.
|
||||
- docs/ntfy.md advises, for ntfy behind Caddy, `behind-proxy: true` in
|
||||
ntfy, and a `stream_close_delay` so that Caddy's reloads do not drop
|
||||
streams.
|
||||
streams at once; and no `response_buffers`.
|
||||
- There is no ntfy-compatible publish endpoint (owner, 2026-12-01).
|
||||
|
||||
Once every phase 5 item has its plan, `docs/plans/formatters.md` folds
|
||||
|
||||
@@ -43,7 +43,6 @@ INVARIANTS (all match the current code)
|
||||
- /healthz per printer, with the status still following the default printer
|
||||
- Jobs stay printer-neutral, so nothing in the block or module code changes.
|
||||
- User templates: planned in docs/plans/templates.md.
|
||||
- An ntfy-compatible publish endpoint, POST /ntfy/{topic} and POST /ntfy, outside /api/v1. Auth is a Bearer JWT, or Basic with an empty user and the JWT as password. Tools that send to an ntfy server URL could then print directly.
|
||||
- More blocks: planned in docs/plans/blocks.md.
|
||||
- Queue.Cancel so message_delete can cancel a still-queued job.
|
||||
- Webhook sources: planned in docs/plans/templates.md.
|
||||
|
||||
+62
-88
@@ -1,115 +1,96 @@
|
||||
# Plan: ntfy over WebSockets
|
||||
|
||||
Status: **planning; nothing is built.** Each stage runs in its own session, briefed from its section, once the owner has answered the questions listed for it or accepted their assumed defaults: stage 1 needs questions 1-6, stage 2 needs 7-13, and stage 3 needs 14-18. Each answer goes into design.md at once and leaves this list. The stages run in order. No stage changes what a card looks like. A check against the owner's own ntfy server, and every receipt on the live printer, needs his OK; the server's address, its topics and the printer's ntfy token stay in the session's scratchpad, never in the repository, a commit, a log, a note or a command line. When the owner accepts the plan, the edits under Overview, ON ACCEPTANCE, are made. Whichever stage finishes last deletes this plan, its findings with it, and design.md's Planned next item 6.
|
||||
Status: **planned; nothing is built.** The owner accepted every proposed default on 2026-12-01 (Decisions), and design.md's Planned next item 6 records them. Each stage runs in its own session, briefed from its section: stage 1 follows decisions 1-6, stage 2 decisions 7-13, and stage 3 decisions 14-18. The stages run in order. No stage changes what a card looks like. A check against the owner's own ntfy server, and every receipt on the live printer, needs his OK; the server's address, its topics and the printer's ntfy token stay in the session's scratchpad, never in the repository, a commit, a log, a note or a command line. Whichever stage finishes last deletes this plan, its findings with it, and design.md's Planned next item 6.
|
||||
|
||||
## Decisions (owner, 2026-11-30)
|
||||
|
||||
- **The subscriber uses ntfy's WebSocket endpoint (`/<topics>/ws`) first
|
||||
and falls back to the JSON stream.** The transport can also be chosen
|
||||
per subscription in the config. Question 14 sets out what the
|
||||
per subscription in the config. Decision 14 sets out what the
|
||||
WebSocket costs behind Caddy.
|
||||
- **It handles ntfy's replay limits:** `X-Messages-Truncated: 1` on a
|
||||
replay cut at 10 MB, and `429` with error code `42905` when the daily
|
||||
bandwidth budget is spent. ntfy 2.38.3 sends neither to a stream, only
|
||||
to a poll; question 4 asks what to do.
|
||||
to a poll; decision 4 says what the subscriber does.
|
||||
- **Resuming by `since=<message ID>` is checked in ntfy's source first,**
|
||||
including what ntfy does once that ID has expired from its cache.
|
||||
Findings, SINCE, and question 1.
|
||||
Findings, SINCE, and decision 1.
|
||||
- **docs/ntfy.md advises, for ntfy behind Caddy, `behind-proxy: true` in
|
||||
ntfy and a `stream_close_delay` in Caddy,** so that Caddy's reloads do
|
||||
not drop streams at once. Question 18.
|
||||
not drop streams at once. Decision 18.
|
||||
- **There is no ntfy-compatible publish endpoint (owner, 2026-12-01).**
|
||||
Überbringer takes no ntfy publish requests; ntfy messages reach it
|
||||
through subscriptions and the `ntfy` module route.
|
||||
|
||||
## Open questions
|
||||
The owner accepted the details below on 2026-12-01. They are numbered, so the rest of the plan can refer to them.
|
||||
|
||||
Each has the default the plan assumes unless the owner says otherwise.
|
||||
For stage 1:
|
||||
|
||||
Before stage 1:
|
||||
|
||||
1. **The cursor stays a server time.** Findings, SINCE. Assumed: the subscriber goes on asking `since=<unix time>` and never sends a message ID. design.md:318-322 gets the reasons below on acceptance.
|
||||
1. **The cursor stays a server time.** Findings, SINCE. The subscriber goes on asking `since=<unix time>` and never sends a message ID.
|
||||
- A known ID resumes right after it. That suits an ntfy cluster, whose nodes can store a message late.
|
||||
- An unknown ID, one that has expired or is not yet stored on the node asked, replays the topic's whole history. The only exception is an ID that node delivered in the last two minutes (server_tail.go:70-85). The subscriber keeps seen IDs only back to two minutes before its cursor, and checks no message against its floor, so such a replay would print again what printed within `max_backlog`.
|
||||
- A time never replays from before the floor.
|
||||
- Trade-off: in an ntfy cluster, a message that a node cut off from its database stores more than two minutes late is missed. The owner's ntfy is one node.
|
||||
- Alternative: send the ID of the newest message dealt with, and leave out any message dated before the floor. That also leaves out a message dated just before a first start, which prints today.
|
||||
2. **The cursor while a replay is under way.** Today each message dealt with moves the cursor to its own time (subscriber.go:560-580). But messages do not always come in time order. ntfy subscribes a connection before it sends `open` and the replay, so a message published meanwhile can come between two replayed ones. ntfy's tail and slow attachment uploads also deliver older messages late (Findings, NTFY'S STREAMS). If such a message moves the cursor and the connection then drops, or the daemon restarts, the next request starts after it. The rest of the replay is never asked for again, and is lost. On the JSON stream this needs a drop or a restart in mid-replay. On a WebSocket a full print queue is enough: the subscription stops reading, answers no ping, and ntfy closes the connection about a minute later (question 11). Assumed: on a connection that asked for a replay (`since`), no message moves the cursor until the first `keepalive`, which moves it to its own time, as today. ntfy sends keepalives only after the replay (server.go:1786-1811), so the first one marks its end. A replay cut short is then asked for again from the old cursor, and the seen IDs drop what printed. A connection without `since` replays nothing and moves the cursor as today. Stage 1 makes this fix on its own.
|
||||
- On a WebSocket, which has no keepalives, the cursor then stays put for the whole connection. The next connection replays it again, within `max_backlog` (question 12), and the seen IDs drop the repeats.
|
||||
- Trade-off: longer replays after a reconnect, and on a WebSocket larger state writes (question 12). Nothing more prints.
|
||||
- Alternatives: cap the cursor at the time of `open`; a replay that reaches back more than two minutes before `open` still loses its rest. Or take a time from WebSocket pings; ntfy starts pinging before the replay (server.go:1878, 1949), a ping can come between replayed messages, and it carries no time.
|
||||
3. **An error written into a stream.** Once ntfy has begun a `200` answer, a later failure is written as one more line of the body: `{"code":…,"http":…,"error":…}` (server.go:715-766). On a stream in 2.38.3 it follows `open`, from a failed cache read; in the middle of a body it comes only on polls. Today the line decodes as a message without an event, which counts as a message (message.go:83-89), so each reconnect would print an empty card. Assumed: on a subscription's connection, an object without `event` that has a numeric `http` field is ntfy's error. It ends the connection as an answer with that status would, except that it has no `Retry-After`, since the answer's headers are gone, so a `429` there backs off. `last_error` reads like `HTTP 500 (ntfy 50001)`. Nothing prints, and ntfy's `error` text stays out of logs and `last_error`. The `ntfy` module route is unchanged. A fix of its own, in stage 1.
|
||||
2. **The cursor while a replay is under way.** Today each message dealt with moves the cursor to its own time (subscriber.go:560-580). But messages do not always come in time order. ntfy subscribes a connection before it sends `open` and the replay, so a message published meanwhile can come between two replayed ones. ntfy's tail and slow attachment uploads also deliver older messages late (Findings, NTFY'S STREAMS). If such a message moves the cursor and the connection then drops, or the daemon restarts, the next request starts after it. The rest of the replay is never asked for again, and is lost. On the JSON stream this needs a drop or a restart in mid-replay. On a WebSocket a full print queue is enough: the subscription stops reading, answers no ping, and ntfy closes the connection about a minute later (decision 11). So, on a connection that asked for a replay (`since`), no message moves the cursor until the first `keepalive`, which moves it to its own time, as today. ntfy sends keepalives only after the replay (server.go:1786-1811), so the first one marks its end. A replay cut short is then asked for again from the old cursor, and the seen IDs drop what printed. A connection without `since` replays nothing and moves the cursor as today. Stage 1 makes this fix on its own.
|
||||
- On a WebSocket, which has no keepalives, the cursor then stays put for the whole connection. The next connection replays it again, within `max_backlog` (decision 12), and the seen IDs drop the repeats.
|
||||
- A cap at the time of `open` is not enough: a replay that reaches back more than two minutes before `open` would still lose its rest. Nor can WebSocket pings stand in for keepalives: ntfy starts pinging before the replay (server.go:1878, 1949), a ping can come between replayed messages, and it carries no time.
|
||||
- Trade-off: longer replays after a reconnect, and on a WebSocket larger state writes (decision 12). Nothing more prints.
|
||||
3. **An error written into a stream.** Once ntfy has begun a `200` answer, a later failure is written as one more line of the body: `{"code":…,"http":…,"error":…}` (server.go:715-766). On a stream in 2.38.3 it follows `open`, from a failed cache read; in the middle of a body it comes only on polls. Today the line decodes as a message without an event, which counts as a message (message.go:83-89), so each reconnect would print an empty card. So, on a subscription's connection, an object without `event` that has a numeric `http` field is ntfy's error. It ends the connection as an answer with that status would, except that it has no `Retry-After`, since the answer's headers are gone, so a `429` there backs off. `last_error` reads like `HTTP 500 (ntfy 50001)`. Nothing prints, and ntfy's `error` text stays out of logs and `last_error`. The `ntfy` module route is unchanged. A fix of its own, in stage 1.
|
||||
- Trade-off: none; only ntfy writes the stream, and its messages always have an event.
|
||||
- Alternative: drop every object without `event` on a subscription.
|
||||
4. **What the replay limits mean for a stream.** ntfy 2.38.3 applies both limits to `poll=1` requests only (Findings, REPLAY LIMITS). So a stream never gets `42905` for its replay. A stream's replay over 10 MiB of one topic is cut, oldest first, without `X-Messages-Truncated`. Assumed: the stream keeps its replay, and the subscriber handles the limits wherever they can appear: a `429` with code `42905` (question 5), `X-Messages-Truncated: 1` on the JSON stream's answer, should a later ntfy send it before `open` (question 6), and an error line (question 3). docs/ntfy.md says that a cut stream replay cannot be seen.
|
||||
4. **What the replay limits mean for a stream.** ntfy 2.38.3 applies both limits to `poll=1` requests only (Findings, REPLAY LIMITS). So a stream never gets `42905` for its replay. A stream's replay over 10 MiB of one topic is cut, oldest first, without `X-Messages-Truncated`. The stream keeps its replay, and the subscriber handles the limits wherever they can appear: a `429` with code `42905` (decision 5), `X-Messages-Truncated: 1` on the JSON stream's answer, should a later ntfy send it before `open` (decision 6), and an error line (decision 3). docs/ntfy.md says that a cut stream replay cannot be seen.
|
||||
- Trade-off: against ntfy 2.38.3, a cut replay goes unnoticed. It takes more than 10 MiB of one topic's messages within `max_backlog`: some 2,500 full-size messages.
|
||||
- Alternative: fetch every replay with a poll. Each connection would open its stream without `since`, read `open` for the server's clock, then poll `/<topics>/json?poll=1&since=…`, deal with that answer, and only then read the stream. Both limits would then show. No stream would carry a replay, so questions 2 and 12 would not arise. But every replay would count against the daily bandwidth budget, which a stream's does not. On a server whose budget is 0, every replay is refused at its first message (visitor.go:249-252). A budget spent part-way ends the answer with an error line. The subscription must then stop printing live messages until the budget refills, or lose the rest of the replay.
|
||||
5. **A `429` with code `42905`.** Assumed: it is a `429` like any other. On the JSON stream's refused answer, the reader takes ntfy's error object from the 4 KiB of body it already reads, and the subscription waits for its `Retry-After`, capped at an hour (subscriber.go:42-43, 846-860), on the same transport. `last_error` reads `HTTP 429: the server's daily bandwidth limit is spent (ntfy 42905)`, and any other ntfy code is named as `(ntfy <code>)`. An error line backs off (question 3). On a refused upgrade ntfy writes no body (server.go:731-745), so there only the status and `Retry-After` are known. The WARN line is today's `ntfy connection lost`, never with the URL. Against ntfy 2.38.3 a subscription never gets `42905` (question 4); the handling is for a later ntfy.
|
||||
5. **A `429` with code `42905`.** It is a `429` like any other. On the JSON stream's refused answer, the reader takes ntfy's error object from the 4 KiB of body it already reads, and the subscription waits for its `Retry-After`, capped at an hour (subscriber.go:42-43, 846-860), on the same transport. `last_error` reads `HTTP 429: the server's daily bandwidth limit is spent (ntfy 42905)`, and any other ntfy code is named as `(ntfy <code>)`. An error line backs off (decision 3). On a refused upgrade ntfy writes no body (server.go:731-745), so there only the status and `Retry-After` are known. The WARN line is today's `ntfy connection lost`, never with the URL. Against ntfy 2.38.3 a subscription never gets `42905` (decision 4); the handling is for a later ntfy.
|
||||
- The same code refuses an attachment download once the budget is spent (server.go:1049). The worker fetches a card's image, and an attached image is optional, so it prints as any failed optional image does. docs/ntfy.md says so.
|
||||
- Trade-off: a `Retry-After` over an hour is cut to an hour, so a spent budget can cost up to 24 refused connections a day, each a WARN line.
|
||||
- Alternative: a longer wait for `42905`, since the budget refills over a day; ntfy's `Retry-After` already says when enough has refilled.
|
||||
6. **A replay the server says it cut.** Assumed: when the JSON stream's answer carries `X-Messages-Truncated: 1`, one WARN line says that the server cut the replay and older messages were lost, without the topic. Nothing prints, and `/healthz` does not change: what ntfy kept is the replay's newest part.
|
||||
- Trade-off: against ntfy 2.38.3 the line never appears (question 4), and only the log would show it.
|
||||
- Alternatives: a count in `/healthz`, a field kept in the API for good that reads 0 against ntfy 2.38.3; or a receipt that says messages were lost.
|
||||
6. **A replay the server says it cut.** When the JSON stream's answer carries `X-Messages-Truncated: 1`, one WARN line says that the server cut the replay and older messages were lost, without the topic. Nothing prints, and `/healthz` does not change: what ntfy kept is the replay's newest part.
|
||||
- Trade-off: against ntfy 2.38.3 the line never appears (decision 4), and only the log would show it.
|
||||
|
||||
Before stage 2:
|
||||
For stage 2:
|
||||
|
||||
7. **The WebSocket library.** Assumed: the `Dialer` of `github.com/fasthttp/websocket` (v1.5.12, the latest), which docs/plans/remote-printers.md decision 5 chose for its agent. One WebSocket implementation then serves the agent and the subscriber. It is pure Go and builds with `CGO_ENABLED=0`. It follows no redirect, and on a refused upgrade it returns the answer's status and headers (Findings, THE WEBSOCKET LIBRARY). Its handshake watches the context only while it dials, so the dial function the subscriber gives it closes the connection once the connection's context ends, from the dial on: a stop never waits for a slow handshake. If remote-printers stage 2 has not brought the library, stage 2 here adds it at its latest release, with the licence notices regenerated.
|
||||
7. **The WebSocket library.** The `Dialer` of `github.com/fasthttp/websocket` (v1.5.12, the latest), which docs/plans/remote-printers.md decision 5 chose for its agent. One WebSocket implementation then serves the agent and the subscriber. It is pure Go and builds with `CGO_ENABLED=0`. It follows no redirect, and on a refused upgrade it returns the answer's status and headers (Findings, THE WEBSOCKET LIBRARY). Its handshake watches the context only while it dials, so the dial function the subscriber gives it closes the connection once the connection's context ends, from the dial on: a stop never waits for a slow handshake. If remote-printers stage 2 has not brought the library, stage 2 here adds it at its latest release, with the licence notices regenerated.
|
||||
- Trade-off: no release since 2025-01-01, as remote-printers.md notes, and a fault there reaches both ends. Its `Conn` takes no context, so a blocked read ends only when the connection is closed.
|
||||
- Alternatives: `github.com/coder/websocket` v1.8.15 (2026-06-15), which takes a context and dials through an `http.Client`, so the stream's client and its redirect refusal would serve both; a second library in the binary. `github.com/gorilla/websocket` v1.5.3 (2024-06-14), which ntfy uses.
|
||||
8. **The WebSocket request.** Assumed: `wss://`, or `ws://` with `allow_insecure`, to `<server>/<topics>/ws`, with the stream's query from the same builder: `since` and, while it is sent, `priority`. The credentials go in the `Authorization` header, as on the stream; never in `?auth=`, which ntfy also reads (server_auth.go:65-78). The request sends `User-Agent: uberbringer`, no `Origin`, no subprotocol and no compression. The dial keeps the stream's limits: 10 s to connect, 30-s TCP keepalives, the proxy from the environment, and 30 s for the whole handshake. A `3xx` is a failed connection with today's message (subscriber.go:773-775).
|
||||
- Trade-off: the library takes `http` and SOCKS5 proxies but not an `https` one, which the stream takes (Findings, THE WEBSOCKET LIBRARY). Question 15 counts that as a refusal, so `auto` uses the stream.
|
||||
- Alternative: `?auth=`, for proxies that strip the header. Not taken, because tokens in query strings end up in proxy logs (design.md:262-263).
|
||||
9. **Pings, the clock and stalls.** ntfy pings a WebSocket every keepalive interval, 45 s by default, and closes it when no pong comes within that interval plus 15 s (server.go:1856-1904). Assumed:
|
||||
- the reader answers each ping at once with a pong, with a 1-s write deadline as the library's own handler has, and sends no pings of its own;
|
||||
- each ping then gives the loop a `ping` event, sent as every event is, so a stop frees the reader (subscriber.go:970-978). It resets the stall timer as a keepalive does: a connection with no message and no ping for twice `keepalive` plus 15 s is opened again. A ping never moves the cursor;
|
||||
- no read deadline is set on the socket; the loop's stall timer closes it, as it closes a stream (subscriber.go:376-379);
|
||||
- a WebSocket learns the server's clock from `open` alone. ntfy's `101` answer has no `Date`, and one a proxy adds is the proxy's clock (design.md:337-339). An `open` without a time ends the connection as a protocol error (question 15);
|
||||
8. **The WebSocket request.** `wss://`, or `ws://` with `allow_insecure`, to `<server>/<topics>/ws`, with the stream's query from the same builder: `since` and, while it is sent, `priority`. The credentials go in the `Authorization` header, as on the stream; never in `?auth=`, which ntfy also reads (server_auth.go:65-78), because tokens in query strings end up in proxy logs (design.md:262-263). The request sends `User-Agent: uberbringer`, no `Origin`, no subprotocol and no compression. The dial keeps the stream's limits: 10 s to connect, 30-s TCP keepalives, the proxy from the environment, and 30 s for the whole handshake. A `3xx` is a failed connection with today's message (subscriber.go:773-775).
|
||||
- Trade-off: the library takes `http` and SOCKS5 proxies but not an `https` one, which the stream takes (Findings, THE WEBSOCKET LIBRARY). Decision 15 counts that as a refusal, so `auto` uses the stream.
|
||||
9. **Pings, the clock and stalls.** ntfy pings a WebSocket every keepalive interval, 45 s by default, and closes it when no pong comes within that interval plus 15 s (server.go:1856-1904).
|
||||
- The reader answers each ping at once with a pong, with a 1-s write deadline as the library's own handler has, and sends no pings of its own.
|
||||
- Each ping then gives the loop a `ping` event, sent as every event is, so a stop frees the reader (subscriber.go:970-978). It resets the stall timer as a keepalive does: a connection with no message and no ping for twice `keepalive` plus 15 s is opened again. A ping never moves the cursor.
|
||||
- No read deadline is set on the socket; the loop's stall timer closes it, as it closes a stream (subscriber.go:376-379).
|
||||
- A WebSocket learns the server's clock from `open` alone. ntfy's `101` answer has no `Date`, and one a proxy adds is the proxy's clock (design.md:337-339). An `open` without a time ends the connection as a protocol error (decision 15).
|
||||
- `keepalive` keeps its meaning, the server's keepalive interval, which ntfy also pings at.
|
||||
- Trade-off: a dead connection is found only after twice `keepalive` plus 15 s, 105 s by default, as on the stream.
|
||||
- Alternative: pings from the subscriber as well, which ntfy answers; ntfy needs none.
|
||||
10. **Message size.** Assumed: as on the stream, a message over 1 MiB is read to its end and skipped, with today's WARN (`ntfy line skipped`, `longer than 1 MiB`), and the connection stays open. The reader takes each frame through `NextReader` into at most 1 MiB and discards the rest, so a frame costs no more memory than a line. A binary frame is skipped as a line that is not JSON. ntfy's own limits keep a message far smaller: a 4,096-byte body, a 1,024-byte title and 512 bytes of tags (config.go:78, 93-94).
|
||||
10. **Message size.** As on the stream, a message over 1 MiB is read to its end and skipped, with today's WARN (`ntfy line skipped`, `longer than 1 MiB`), and the connection stays open. The reader takes each frame through `NextReader` into at most 1 MiB and discards the rest, so a frame costs no more memory than a line. A binary frame is skipped as a line that is not JSON. ntfy's own limits keep a message far smaller: a 4,096-byte body, a 1,024-byte title and 512 bytes of tags (config.go:78, 93-94). The library's `SetReadLimit` is not used: it ends the connection, the next replay would send the message again, and a subscription with `transport = "websocket"` would never get past it.
|
||||
- Trade-off: a hostile server can still keep the subscriber reading, as on the stream.
|
||||
- Alternative: the library's `SetReadLimit`, which ends the connection instead. The next replay would send the message again, so a subscription with `transport = "websocket"` would never get past it.
|
||||
11. **A full print queue on a WebSocket.** While the handler cannot take a message, the loop stops reading (design.md:312-317), so the reader answers no ping. Assumed: nothing special. ntfy closes the connection about a minute later. The reader's last events wait until the queue has room; then the subscription reconnects after the usual backoff, and question 2 keeps the cursor behind what it has not dealt with. The JSON stream stays open through such a pause, held by TCP backpressure, since ntfy's HTTP server has no write timeout (server.go:509).
|
||||
11. **A full print queue on a WebSocket.** While the handler cannot take a message, the loop stops reading (design.md:312-317), so the reader answers no ping. Nothing special is done. ntfy closes the connection about a minute later. The reader's last events wait until the queue has room; then the subscription reconnects after the usual backoff, and decision 2 keeps the cursor behind what it has not dealt with. The JSON stream stays open through such a pause, held by TCP backpressure, since ntfy's HTTP server has no write timeout (server.go:509).
|
||||
- Trade-off: one reconnect, with its replay, after each pause longer than about a minute. docs/ntfy.md says so.
|
||||
- Alternative: keep answering pings during a pause, holding messages in memory up to a bound; more code for a reconnect that loses nothing.
|
||||
12. **`max_backlog` while connected.** With question 2, a WebSocket's cursor stays put, and the seen IDs are kept from two minutes before the cursor (state.go:184-197). On a long connection they would grow to the 20,000 cap. Assumed: at each save, while the connection knows the server's clock, the floor rises to the server's time now less `max_backlog`, computed as `checkBacklog` computes it (subscriber.go:596-608). The raised floor bounds the next replay and the seen IDs, and nothing else: a message on the current connection is not checked against it, so one held in a JSON stream through a long printer outage still prints, as today. It applies to both transports; on the stream, whose keepalives move the cursor, it rarely changes anything.
|
||||
12. **`max_backlog` while connected.** With decision 2, a WebSocket's cursor stays put, and the seen IDs are kept from two minutes before the cursor (state.go:184-197). On a long connection they would grow to the 20,000 cap. So, at each save, while the connection knows the server's clock, the floor rises to the server's time now less `max_backlog`, computed as `checkBacklog` computes it (subscriber.go:596-608). The raised floor bounds the next replay and the seen IDs, and nothing else: a message on the current connection is not checked against it, so one held in a JSON stream through a long printer outage still prints, as today. It applies to both transports; on the stream, whose keepalives move the cursor, it rarely changes anything.
|
||||
- Trade-off: on a WebSocket every save writes the IDs within `max_backlog`, about 60 an hour at a message a minute. A busy topic with a 12-hour `max_backlog` can reach the 20,000 cap, some 700 KB written and synced within a second of each message. The stream writes about two minutes' worth.
|
||||
- Alternative: a lower cap of its own on the IDs a WebSocket keeps.
|
||||
13. **The config key and the Go field.** Assumed: `transport` per subscription, `"websocket"` or `"json"`, written exactly so. Its default is `"json"` in stage 2, so a build between stages 2 and 3 behaves as today unless a subscription asks; stage 3 adds `"auto"` and makes it the default (questions 14 and 15). In Go, `ntfy.Options.Transport` takes this meaning, and today's field of that name, the stream's `http.RoundTripper`, becomes `RoundTripper` in stage 2's first commit.
|
||||
13. **The config key and the Go field.** `transport` per subscription, `"websocket"` or `"json"`, written exactly so. Its default is `"json"` in stage 2, so a build between stages 2 and 3 behaves as today unless a subscription asks; stage 3 adds `"auto"` and makes it the default (decisions 14 and 15). In Go, `ntfy.Options.Transport` takes this meaning, and today's field of that name, the stream's `http.RoundTripper`, becomes `RoundTripper` in stage 2's first commit.
|
||||
- Trade-off: the default changes again in stage 3, so a build between the two stages differs from the release.
|
||||
- Alternatives: the name `protocol`, as ntfy's Android app calls its setting; or the values `ws` and `stream`.
|
||||
|
||||
Before stage 3:
|
||||
For stage 3:
|
||||
|
||||
14. **Whether WebSockets come first.** The owner decided that the subscriber uses the WebSocket first. Behind Caddy, the findings show the JSON stream as good or better on each count this plan examines:
|
||||
- Replays: with question 2, a WebSocket's cursor does not move during a connection, so each reconnect replays up to `max_backlog` of messages, where the stream replays about two minutes.
|
||||
- Pauses: a full queue for more than about a minute closes a WebSocket (question 11); the stream stays open.
|
||||
- Reloads: a Caddy reload closes every WebSocket, at once or after `stream_close_delay`; it leaves the stream open under Caddy's default grace period (question 18).
|
||||
14. **WebSockets come first.** The owner keeps the WebSocket first, and `auto` is the default from stage 3. Behind Caddy, the findings show the JSON stream as good or better on each count this plan examines; these are the costs he accepts:
|
||||
- Replays: with decision 2, a WebSocket's cursor does not move during a connection, so each reconnect replays up to `max_backlog` of messages, where the stream replays about two minutes.
|
||||
- Pauses: a full queue for more than about a minute closes a WebSocket (decision 11); the stream stays open.
|
||||
- Reloads: a Caddy reload closes every WebSocket, at once or after `stream_close_delay`; it leaves the stream open under Caddy's default grace period (decision 18).
|
||||
- Code: a second transport, and a library without a release since 2025-01-01.
|
||||
|
||||
The usual reason for WebSockets, a proxy that buffers a streamed answer, does not hold for Caddy, which flushes ntfy's stream at once. Assumed: the decision stands, and `auto` is the default from stage 3.
|
||||
- Trade-off: the costs above, for no gain found behind Caddy.
|
||||
- Alternative: keep `"json"` the default, with `"websocket"` and `"auto"` for subscriptions that ask. Stages 2 and 3 are then built the same, less stage 3's second commit.
|
||||
15. **`auto`, and what counts as a refusal.** Assumed: `transport = "auto"` tries the WebSocket and falls back to the JSON stream when the answer shows that the server, or a proxy in front of it, does not take WebSockets:
|
||||
The usual reason for WebSockets, a proxy that buffers a streamed answer, does not hold for Caddy, which flushes ntfy's stream at once. `transport = "json"` keeps a subscription on the stream.
|
||||
15. **`auto`, and what counts as a refusal.** `transport = "auto"` tries the WebSocket and falls back to the JSON stream when the answer shows that the server, or a proxy in front of it, does not take WebSockets:
|
||||
- the upgrade is answered with a status other than `101` that is not a `3xx`, `401`, `403`, `408`, `429` or `5xx`. ntfy answers `400` with code `40016` when a proxy dropped the `Upgrade` header (server.go:1817-1819), and an old server or a proxy without the path answers `404`;
|
||||
- the library refuses a `101` answer (`ErrBadHandshake` with a `101`, or a compression it did not offer);
|
||||
- an open WebSocket breaks the protocol: one of the library's `websocket:` errors that is neither a `*CloseError`, a `net.Error` nor end of file;
|
||||
- an `open` without a time (question 9);
|
||||
- a proxy setting the library cannot use, such as an `https` proxy (question 8);
|
||||
- an `open` without a time (decision 9);
|
||||
- a proxy setting the library cannot use, such as an `https` proxy (decision 8);
|
||||
- three connections in a row closed after the `101` and before `open`. ntfy writes `open` right after the upgrade (server.go:1943-1948), so this marks a broken tunnel while the server itself is up.
|
||||
|
||||
Every other failure keeps the transport and backs off as today, since the stream would fail the same way: a dial or TLS error, a timeout, a `3xx`, `401` or `403`, a `429`, a `5xx`, a stall, and a close. ntfy closes a WebSocket without a close frame, which reads as code 1006, and Caddy's reload sends 1001; both are closes. The fallback connects at once, without a backoff step, since the refusal said nothing about the server's health.
|
||||
- Trade-off: a proxy that keeps the tunnel open past `open` and breaks it later shows as repeated drops, not as a refusal, so `auto` stays on the WebSocket. `transport = "json"` is the cure, and docs/ntfy.md says so.
|
||||
- Alternative: fall back after a number of failed WebSocket attempts of any kind, which also falls back while the server is down.
|
||||
16. **How long a fallback lasts.** Assumed: a subscription that fell back uses the JSON stream for at least an hour. It tries the WebSocket again on its first reconnect after that, never by dropping a working stream. A restart tries the WebSocket first, since the fallback is not saved. One INFO line says that the subscription falls back, with the status and never the URL, and one says when the WebSocket works again.
|
||||
16. **How long a fallback lasts.** A subscription that fell back uses the JSON stream for at least an hour. It tries the WebSocket again on its first reconnect after that, never by dropping a working stream. A restart tries the WebSocket first, since the fallback is not saved. One INFO line says that the subscription falls back, with the status and never the URL, and one says when the WebSocket works again.
|
||||
- Trade-off: at most one refused upgrade an hour, and one per restart.
|
||||
- Alternatives: stay on the stream until the daemon restarts; or save the fallback in the state file.
|
||||
17. **`/healthz`.** Assumed: each subscription gains `transport`, `websocket` or `json`, the one its current or last connection uses. A fallback is not an error, so `last_error` keeps its meaning.
|
||||
17. **`/healthz`.** Each subscription gains `transport`, `websocket` or `json`, the one its current or last connection uses. A fallback is not an error, so `last_error` keeps its meaning.
|
||||
- Trade-off: a field kept in the API for good.
|
||||
- Alternative: the log lines only.
|
||||
18. **Caddy and ntfy settings in docs/ntfy.md.** Assumed: a section, ntfy behind Caddy, that advises:
|
||||
18. **Caddy and ntfy settings in docs/ntfy.md.** A section, ntfy behind Caddy, advises:
|
||||
- in ntfy's `server.yml`, `behind-proxy: true`. ntfy then tells clients apart by the `X-Forwarded-For` header Caddy sets, instead of counting every client, the printer among them, as Caddy's one address in its rate limits;
|
||||
- in the `reverse_proxy` of ntfy's site, `stream_close_delay 5m`. A reload otherwise closes every proxied WebSocket at once. With it, a WebSocket stays open for up to five minutes after a reload, and then closes; the delay moves the reconnect later and spreads the reconnects of many clients, but does not avoid it;
|
||||
- that the JSON stream is a plain answer, which a reload leaves open until it ends, unless Caddy's global `grace_period` is set; it then closes when that period ends;
|
||||
@@ -117,7 +98,6 @@ Before stage 3:
|
||||
- that the subscription loses nothing to a reload either way, since it resumes from its cursor;
|
||||
- that a proxy that cannot pass WebSockets makes `auto` fall back, and that `transport = "json"` avoids the refused upgrade.
|
||||
- Trade-off: the advice covers Caddy only. For other proxies it points to ntfy's docs.
|
||||
- Alternative: a whole Caddyfile for ntfy; ntfy's docs have one.
|
||||
|
||||
## Investigation findings
|
||||
|
||||
@@ -177,8 +157,8 @@ THE SUBSCRIBER TODAY
|
||||
|
||||
WHERE THIS IS UNSURE
|
||||
- Whether net/http's server, upgraded by fasthttp/websocket over `net.Pipe` connections, runs inside a `testing/synctest` bubble. Stage 2 checks it before it builds the fake on it.
|
||||
- Whether a later ntfy sends `X-Messages-Truncated` or charges bandwidth on streams, as its docs say. Questions 5 and 6 cover both if it does.
|
||||
- How often the owner's Caddy reloads, which decides how much question 18's delay matters.
|
||||
- Whether a later ntfy sends `X-Messages-Truncated` or charges bandwidth on streams, as its docs say. Decisions 5 and 6 cover both if it does.
|
||||
- How often the owner's Caddy reloads, which decides how much decision 18's delay matters.
|
||||
|
||||
SOURCES
|
||||
- ntfy, tag v2.38.3: https://github.com/binwiederhier/ntfy/tree/v2.38.3, chiefly server/server.go, server/server_auth.go, server/server_tail.go, server/server_drain.go, server/errors.go, server/visitor.go, server/topic.go, server/config.go, message/cache.go, message/cache_sqlite.go and model/model.go.
|
||||
@@ -218,18 +198,12 @@ OTHER PLANS
|
||||
- docs/plans/templates.md stages 2 and 3 change `deliver`, which both transports reach the same way.
|
||||
- docs/plans/remote-printers.md shares fasthttp/websocket (its decision 5). Its `stream_close_delay` is for Überbringer's own Caddy site; this plan's is for the ntfy server's.
|
||||
|
||||
ON ACCEPTANCE
|
||||
When the owner accepts this plan, these edits are made:
|
||||
- design.md: Planned next item 6 records the answers. The ntfy subscriptions paragraph's reason for a time cursor (design.md:318-322) gives the conditions in question 1: an unknown ID replays the whole history unless that node delivered it in the last two minutes.
|
||||
- docs/plans/formatters.md: its phase 5 item for an ntfy-compatible publish endpoint goes, since there is none. Every other item then has its plan, so design.md:561-562 applies: formatters.md folds into design.md and goes. The edits that printers.md and job-store.md make to it on their acceptance then go to design.md.
|
||||
- docs/plans/templates.md: the open point in its Findings on the publish endpoint (line 194) goes.
|
||||
|
||||
## Architecture
|
||||
|
||||
TRANSPORTS (stages 1-3)
|
||||
- Today's reader, `conn.read` (subscriber.go:924-968), becomes one of two readers, chosen per connection: the stream's, unchanged, and the WebSocket's. Both send the loop the same events: `opened` with the answer's `Date`, `msg`, `skipped`, and `end` with the status, `Retry-After` and ntfy's code. The WebSocket's adds `ping`, and its `end` says whether the WebSocket was refused, for `auto`.
|
||||
- One function builds the query, `since` and `priority`, for both. The WebSocket URL swaps the scheme (`https` to `wss`, `http` to `ws`) and the last path part (`/json` to `/ws`).
|
||||
- `Options.Transport` names the transport (question 13), and `Options.DialContext` (name assumed) the WebSocket's dial function, which tests replace.
|
||||
- `Options.Transport` names the transport (decision 13), and `Options.DialContext` (name assumed) the WebSocket's dial function, which tests replace.
|
||||
|
||||
THE WEBSOCKET READER (stage 2)
|
||||
|
||||
@@ -249,11 +223,11 @@ ws, resp, err := d.DialContext(ctx, wsURL, header) // Authorization and User-Age
|
||||
- Stopping sends a close frame with code 1000 under a 1-s deadline, then closes the socket.
|
||||
|
||||
THE CURSOR (stages 1 and 2)
|
||||
- A connection keeps whether it asked for a replay and whether a keepalive has come. Before that keepalive, `dealt` records a message in the seen IDs and the state, and leaves the cursor where it is (question 2).
|
||||
- `save` raises the floor to the server's time less `max_backlog` while a connection knows the clock (question 12), before it prunes the seen IDs.
|
||||
- A connection keeps whether it asked for a replay and whether a keepalive has come. Before that keepalive, `dealt` records a message in the seen IDs and the state, and leaves the cursor where it is (decision 2).
|
||||
- `save` raises the floor to the server's time less `max_backlog` while a connection knows the clock (decision 12), before it prunes the seen IDs.
|
||||
|
||||
FALLBACK (stage 3)
|
||||
- The run keeps the time until which `auto` uses the stream, and how many WebSockets in a row closed before `open`. `connect` picks the WebSocket for `websocket`, the stream for `json`, and for `auto` the WebSocket unless that time is still ahead. A refusal (question 15) under `auto` sets it an hour ahead and connects again at once.
|
||||
- The run keeps the time until which `auto` uses the stream, and how many WebSockets in a row closed before `open`. `connect` picks the WebSocket for `websocket`, the stream for `json`, and for `auto` the WebSocket unless that time is still ahead. A refusal (decision 15) under `auto` sets it an hour ahead and connects again at once.
|
||||
- `Status` gains `Transport`, set when a connection starts.
|
||||
|
||||
```json
|
||||
@@ -280,15 +254,15 @@ Every commit below that changes behaviour carries its own tests, docs, regenerat
|
||||
|
||||
### Stage 1: The cursor, errors and replay limits
|
||||
|
||||
**Goal.** Today's subscriber, on the JSON stream: no message moves the cursor during a replay, an error ntfy writes into a stream prints nothing, ntfy's error codes are named, and a replay the server says it cut is logged. Questions 1-6.
|
||||
**Goal.** Today's subscriber, on the JSON stream: no message moves the cursor during a replay, an error ntfy writes into a stream prints nothing, ntfy's error codes are named, and a replay the server says it cut is logged. Decisions 1-6.
|
||||
|
||||
**Work.**
|
||||
|
||||
internal/pkg/ntfy
|
||||
- subscriber.go:
|
||||
- `conn` keeps whether a keepalive has come; `dealt` leaves the cursor alone on a connection with `since` until then (question 2). A first start, without `since`, is unchanged.
|
||||
- An object without `event` and with a numeric `http` ends the connection as that status would, with no `Retry-After` (question 3).
|
||||
- `read` takes ntfy's error object from a refused answer's body, and notes `X-Messages-Truncated: 1` on an accepted one (questions 5 and 6).
|
||||
- `conn` keeps whether a keepalive has come; `dealt` leaves the cursor alone on a connection with `since` until then (decision 2). A first start, without `since`, is unchanged.
|
||||
- An object without `event` and with a numeric `http` ends the connection as that status would, with no `Retry-After` (decision 3).
|
||||
- `read` takes ntfy's error object from a refused answer's body, and notes `X-Messages-Truncated: 1` on an accepted one (decisions 5 and 6).
|
||||
- `event` gains ntfy's code; `reconnect` names it as `(ntfy <code>)`, and words `42905`, never with ntfy's text.
|
||||
- The loop logs a cut replay at WARN, without the topic.
|
||||
- message.go: the error object's type.
|
||||
@@ -309,7 +283,7 @@ internal/pkg/ntfy, on the virtual clock
|
||||
- The first keepalive moves the cursor to its time.
|
||||
- A connection without `since` is not held: TestFirstStartSendsNoSince and TestKeepalivesSaveTheCursorLazily pass unchanged.
|
||||
- An error line right after `open`, and one in the middle of a replay: nothing prints, `last_error` is `HTTP 500 (ntfy 50001)`, the subscription backs off, and no log line holds ntfy's text. An error line with `429` backs off without waiting for a `Retry-After`.
|
||||
- A refused answer `429` with code `42905` and `Retry-After: 90`: `last_error` reads as question 5 says, and the subscription waits 90 s.
|
||||
- A refused answer `429` with code `42905` and `Retry-After: 90`: `last_error` reads as decision 5 says, and the subscription waits 90 s.
|
||||
- An answer with `X-Messages-Truncated: 1`: one WARN line without the topic, and every message of the replay printed.
|
||||
- The soak sends live and late messages inside replays and drops some replays half-way; every message still prints once.
|
||||
|
||||
@@ -324,18 +298,18 @@ internal/pkg/ntfy, on the virtual clock
|
||||
|
||||
### Stage 2: The WebSocket transport
|
||||
|
||||
**Goal.** `transport = "websocket"` reads a subscription's topics over ntfy's `/ws`, with today's rules; `"json"`, the default for now, keeps the stream. The floor follows `max_backlog` while connected. Questions 7-13. Needs stage 1.
|
||||
**Goal.** `transport = "websocket"` reads a subscription's topics over ntfy's `/ws`, with today's rules; `"json"`, the default for now, keeps the stream. The floor follows `max_backlog` while connected. Decisions 7-13. Needs stage 1.
|
||||
|
||||
**Work.**
|
||||
|
||||
internal/pkg/ntfy
|
||||
- transport.go (new; name assumed): the reader seam, with the stream's reader moved there unchanged, and the query builder both use. `Options.Transport` becomes `Options.RoundTripper` (question 13).
|
||||
- websocket.go (new; name assumed): the dial function, the dialer and the reader (Architecture, THE WEBSOCKET READER; questions 7-11).
|
||||
- transport.go (new; name assumed): the reader seam, with the stream's reader moved there unchanged, and the query builder both use. `Options.Transport` becomes `Options.RoundTripper` (decision 13).
|
||||
- websocket.go (new; name assumed): the dial function, the dialer and the reader (Architecture, THE WEBSOCKET READER; decisions 7-11).
|
||||
- subscriber.go:
|
||||
- `Options` gains `Transport` and `DialContext`;
|
||||
- `connect` picks the reader; `event` takes `ping`, which only resets the stall timer;
|
||||
- on a WebSocket, the clock comes from `open` alone (question 9);
|
||||
- `save` raises the floor (question 12);
|
||||
- on a WebSocket, the clock comes from `open` alone (decision 9);
|
||||
- `save` raises the floor (decision 12);
|
||||
- `describe` names a WebSocket close code.
|
||||
- doc comments: `Keepalive` is also the ping interval; the package comment names both transports.
|
||||
|
||||
@@ -395,12 +369,12 @@ Commit 1 changes no behaviour: the existing tests pass unchanged, and it has no
|
||||
|
||||
### Stage 3: WebSockets first, with a fallback
|
||||
|
||||
**Goal.** `auto` tries the WebSocket and falls back to the JSON stream when the WebSocket is refused, and becomes the default. `/healthz` shows each subscription's transport. docs/ntfy.md advises on ntfy behind Caddy. Questions 14-18. Needs stage 2.
|
||||
**Goal.** `auto` tries the WebSocket and falls back to the JSON stream when the WebSocket is refused, and becomes the default. `/healthz` shows each subscription's transport. docs/ntfy.md advises on ntfy behind Caddy. Decisions 14-18. Needs stage 2.
|
||||
|
||||
**Work.**
|
||||
|
||||
internal/pkg/ntfy
|
||||
- subscriber.go: the refusals that make `auto` fall back (question 15); the fallback's hour and the INFO lines (question 16); `Status.Transport`.
|
||||
- subscriber.go: the refusals that make `auto` fall back (decision 15); the fallback's hour and the INFO lines (decision 16); `Status.Transport`.
|
||||
|
||||
internal/pkg/config
|
||||
- `transport` takes `auto` (commit 1), the default from commit 2.
|
||||
@@ -411,7 +385,7 @@ server and internal/app/uberbringer
|
||||
Docs
|
||||
- docs/configuration.md and configs/config.example.toml: `auto`, then the default.
|
||||
- docs/configuration.md, Logs: the INFO lines for a fallback and for the WebSocket working again.
|
||||
- docs/ntfy.md: the fallback, and when to set `json`; a section, ntfy behind Caddy (question 18).
|
||||
- docs/ntfy.md: the fallback, and when to set `json`; a section, ntfy behind Caddy (decision 18).
|
||||
- docs/api.md, Health: `transport` in the example and the table.
|
||||
- design.md, the ntfy subscriptions paragraph: WebSockets first, the fallback.
|
||||
- CHANGELOG: the `[Unreleased]` subscriptions entry says that subscriptions use WebSockets first and that `/healthz` shows the transport. The commit that only adds docs has no edit.
|
||||
@@ -435,7 +409,7 @@ server
|
||||
3. Show each ntfy subscription's transport in /healthz
|
||||
4. Document ntfy behind Caddy
|
||||
|
||||
Commit 1 adds `auto` as a value, with its config docs; commit 2 makes it the default. If the owner keeps `json` the default (question 14), commit 2 goes.
|
||||
Commit 1 adds `auto` as a value, with its config docs; commit 2 makes it the default.
|
||||
|
||||
**Done when.**
|
||||
- The full gate passes.
|
||||
|
||||
@@ -190,9 +190,6 @@ WEBHOOK SENDERS
|
||||
- Standard Webhooks 1.0.0: the secret is 24-64 random bytes, base64-encoded after `whsec_`; the signature header may hold several, space-separated, for key rotation, and `v1a` is a deprecated version; the timestamp must be within a tolerance the specification leaves open.
|
||||
- Caddy's access log redacts `Cookie`, `Set-Cookie`, `Authorization` and `Proxy-Authorization` and logs every other request header as sent.
|
||||
|
||||
THE OTHER PLANS
|
||||
- design.md's Planned next item 6 adds an ntfy-compatible publish endpoint, another input outside `/api/v1`. Whether its messages pass through `[[ntfy.rules]]` is for that plan to settle.
|
||||
|
||||
WHERE THE FINDINGS ARE UNSURE
|
||||
- Forgejo's headers: its docs' example only, not its source.
|
||||
- GitLab's `Content-Type`; whether `webhook-timestamp` stays the same across its retries; and whether its signing token takes the `whsec_` form: its docs do not say.
|
||||
|
||||
Reference in new issue
Block a user