openrpc_client!: SSE streaming + multi-domain bundle support on wasm/gloo-net #147
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_lib#147
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Follow-up to the wasm/Dioxus support added for
openrpc_client!(target-gatedherolib_openrpctransport + generatedClient::new(base_url)for wasm32).Two pieces were intentionally deferred from v1 and are native-only today:
1. SSE streaming on wasm
The generated
events()/subscribe_events_at()and the per-methodx-ssehelpers (*_events,follow_*_sse,collect_*_sse) are#[cfg(not(target_arch = "wasm32"))]. The native path uses hyper/tokio SSE-over-UDS (crates/openrpc/src/sse.rs), which can't run in the browser.Task: add a browser SSE transport using
gloo-net'sEventSource(featureeventsource), expose it on the wasmOpenRpcTransportassse_subscribe, and drop the wasm gate on the generated SSE helpers so they emit on both targets. KeepSseEventshared across targets.2. Multi-domain bundle on wasm
The directory-form bundle (
openrpc_client!("dir", service = "...")→HeroDemoClientwith.dom1()/.dom2()) connects over Unix sockets; itsconnect()is#[cfg(not(target_arch = "wasm32"))]. The inner per-domain clients already get a wasmnew(base_url).Task: add a wasm bundle
new(base_url)that builds each domain client over HTTP, once the hero_router per-domain URL convention is confirmed (e.g.{base_url}/<service>_<domain>/rpcvs{base_url}/<domain>/rpc).Pointers
crates/openrpc/src/transport/openrpc.rs(native + wasmOpenRpcTransport)crates/derive/src/openrpc_client.rs(generate_client_code,generate_client_bundle)crates/openrpc/Cargo.toml(target-gatedgloo-net)