pub struct WsClient { /* private fields */ }Implementations§
Source§impl WsClient
impl WsClient
pub fn new( url: String, edge_id: String, version: String, capabilities: Vec<String>, engine: Arc<RoutingEngine>, glyphs: Arc<GlyphRegistry>, ) -> Self
Sourcepub fn with_device_control(
url: String,
edge_id: String,
version: String,
capabilities: Vec<String>,
engine: Arc<RoutingEngine>,
glyphs: Arc<GlyphRegistry>,
device_control: Arc<dyn DeviceControlHook>,
) -> Self
pub fn with_device_control( url: String, edge_id: String, version: String, capabilities: Vec<String>, engine: Arc<RoutingEngine>, glyphs: Arc<GlyphRegistry>, device_control: Arc<dyn DeviceControlHook>, ) -> Self
Construct a WsClient with a host-supplied DeviceControlHook. The
edge-agent binary wires this to its per-device map so weave-server
can drive Connect / Disconnect / Test-LED via the WS protocol.
Sourcepub fn with_intent_dispatcher(self, tx: Sender<RoutedIntent>) -> Self
pub fn with_intent_dispatcher(self, tx: Sender<RoutedIntent>) -> Self
Wire the edge-agent’s dispatcher channel so this WS client can
hand ServerToEdge::DispatchIntent payloads to the same
(service_type, target) worker pool that locally-routed intents
flow through. Without this hook, forwarded intents are logged
and dropped — fine for hosts whose adapters never receive
cross-edge work.
Sourcepub fn outbox(&self) -> Sender<EdgeToServer>
pub fn outbox(&self) -> Sender<EdgeToServer>
Get a sender for outbound EdgeToServer frames. Clone as many times
as needed; adapters publish state updates via this channel.
Sourcepub fn resync_sender(&self) -> Sender<()>
pub fn resync_sender(&self) -> Sender<()>
Clone the ws/edge (re)connect broadcaster. Fires once per
successful connect + Hello exchange. State-pumps subscribe to this
and replay the most recent frame per
(service_type, target, property, output_id) key so weave-server
recovers its full snapshot after a restart — otherwise idle zones
/ lights that haven’t changed since the last connect disappear
from the UI because the adapter’s source-side dedup suppresses
re-sends.
Sourcepub async fn prime_from_cache(&self) -> Result<()>
pub async fn prime_from_cache(&self) -> Result<()>
Populate the routing engine + glyph registry from the local cache, if
one exists. Call this once at startup before entering run().