Realtime: public live feeds for read:public collections via project id#75
Merged
Conversation
Extend non-secret project-id access (multi-tenant) to the realtime live feed of
a read:public collection, so a published frontend can stream changes without
embedding a secret — closing the gap left when public collections shipped.
- Auth hook: when no key is presented but a project id is, allow a read-only
realtime request (WS subscribe, or GET history/presence) on a
`data:<collection>` channel iff that collection's read ACL is public. Writes,
the channel list, and non-data channels still require a key.
- The WS socket for an anonymous (authed=false) connection is read-only: inbound
frames (publish/typing) are ignored.
- The SDK already sends ?project= on the socket, so
`Zero(base, { project }).data('posts').subscribe(...)` just works.
Verification: 62/62 SQLite (+ a new test: public feed delivers changes, the
socket can't publish, and a private collection's feed is rejected), 44/44
Postgres 16, Redis fan-out test green. Docs updated (README, /docs).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Next-roadmap item 1/2 (the API-developer side). Extends the non-secret project-id access to the realtime live feed of a
read:publiccollection, so a published frontend can stream live changes without embedding a secret — closing the gap left when public collections shipped (#72): you could read public data by project id, but not subscribe to its updates.How
X-Project-Id/?project=), allow a read-only realtime request — WS subscribe, orGET …/history/…/presence— on adata:<collection>channel iff that collection's read ACL ispublic. Writes (POST), the channel list, and non-data:channels still require a key.authed === false) connection the WS ignores inbound frames, so a public viewer can't publish or signal typing.?project=on the socket, soZero(base, { project }).data('posts').subscribe(…)works with no change.The mapping is principled: public data ⇒ public live feed, governed by the same per-collection ACL — no new access surface.
Verification
/docs.Next up: Redis-backed rate limiting + presence TTLs (the operator-side hardening of the multi-process path).
https://claude.ai/code/session_018efxvWw3MRjdtvE5xgBqya
Generated by Claude Code