feat(server): add per-domain web_events.sock router extension hook #39
No reviewers
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_rpc!39
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_messaging_sse_subscribe"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds a generator hook so per-domain HTTP servers can register supplementary axum routes (e.g. SSE endpoints) on a dedicated
web_events.sock, alongside the existingrpc.sockandui.sock. Used byhero_osisto mountGET /eventsfor the messaging archipelago's live update feed.Backwards-compatible — domains without a registered extension are emitted exactly as before (
extension: None, no extra socket bound).Related Issue
Part of the multi-repo fix for hero_archipelagos #182 (messaging: no live updates — recipient must reload to see new messages).
This PR is the first of three:
subscribe().Changes
crates/generator/src/build/build.rsOschemaBuildConfig::with_domain_router_ext(domain, fqfn)builder method backed by a newdomain_router_ext: HashMap<String, String>field.single_binandper_domain_bins) emit theextension: <expr>field on the generatedDomainServiceliteral —Some(<fqfn>())if registered,Noneotherwise.crates/server/src/server/spawn.rsextension: Option<axum::Router>field onDomainService(defaultNone).spawn_domain_serverbinds the router on a new$HERO_SOCKET_DIR/<service>/web_events.socklistener — sibling torpc.sockandui.sock. hero_router auto-discovers it via the standardweb_<name>.sockconvention (/<service>/events→web_events.sockat path/).OServer::run()unchanged — the extension is not mounted onrpc.sock.crates/server/src/server/server.rsandunified_server.rsOServer::run_with_extension(Option<Router>)andUnifiedServerBuilder::serve_with_extension(...)overloads. Existingrun()/serve()delegate withNone. (Kept for callers that want the legacymerge-onto-rpc.sockbehaviour; the new spawn path no longer uses them.)Test Plan
cargo check --workspace --lib --bins— clean.cargo test -p hero_rpc_server -p hero_rpc_generator --lib— 13 + 105 tests pass, no regressions.--all-targetsfailures incrates/osis/examples/are unchanged from the development baseline (verified by stash + check).Notes
per_domain_binsgenerator path still emitsserver.run_with_extension(<expr>)— would mount onrpc.socklike the original Step 1 design. We didn't update it because no current consumer uses that path. Worth a future cleanup to align withsingle_bin.Cargo.lockand example regen drift inexample/recipe_server/are deliberately not committed.