docs(channels): example, README section, ROADMAP v0.6 mark-done — chunk 4

examples/channels_chat.rs (required-features phoenix): ephemeral
room:* and persistent session:* side by side over phoenix.js V2 JSON,
stdin-driven graceful shutdown (the ws_chat pattern). Smoke-tested
live: rejoin after transport drop lands on the same instance (state
counter persists across three transports), broadcasts carry the new
join generation's ref.

README: channels section (feature split, core trait walkthrough,
session persistence semantics incl. the re-entrant-join contract).
ROADMAP: v0.6 marked done with the full as-landed decision list,
chunked as committed.
This commit is contained in:
Claude
2026-06-12 15:26:21 +00:00
parent 0de2baa72d
commit 86c8d31b93
4 changed files with 225 additions and 4 deletions
+19 -1
View File
@@ -263,7 +263,7 @@ smarm has none). All six design questions ratified by the user pre-code
Chunk 2's ws_chat: rooms as topics, `on_open` subscribes (conn-actor
pid) + spawns the relay, `broadcast_from(self_pid(), ..)` for no-echo.
## v0.6 — Channels
## v0.6 — Channels — DONE (2026-06-12)
Join/leave/event protocol over WebSocket transport, PubSub underneath.
Design decisions ratified pre-code (2026-06-12):
@@ -329,6 +329,24 @@ reconnect cycles.
**Presence:** explicitly out of scope until distribution exists.
**As-landed (2026-06-12), beyond the ratified text — veto by diff:**
- chunk 1: `Channel::join` takes `&mut self` (state from join, and
session rejoins need the same instance); the in-flight ref is
threaded invisibly through the socket; `broadcast` gained an `event`
parameter; `TopicRouter::route` returns `Option<Arc<dyn
ChannelFactory>>`.
- chunk 2: the serde blanket lives behind the `Json<T>` newtype
(a blanket on bare `P: Serialize` is coherence poison under additive
features); encode failure panics into the linked-teardown contract.
- chunk 3: `ChannelFactory` gained a `#[doc(hidden)] deploy()` seam
(default = the ephemeral linked actor); every attach re-calls
`join()` (re-entrant by contract); rejected rejoin / explicit leave /
cap / TTL all end the session; second transport evicts the first;
`Key: Clone` (registry's pid→key reverse index); registry spawns
eagerly at registration (in-runtime law, same as `ChannelHub::new`);
shutdown composes linklessly via the registry-drop chain — proven by
`shutdown_with_detached_session_terminates`.
---
## Known bugs