pub struct Client { /* private fields */ }Expand description
Long-lived protocol-1 WebSocket client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn with_config(cfg: ClientConfig) -> Self
pub fn with_config(cfg: ClientConfig) -> Self
Create with explicit config.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether the socket is connected.
Sourcepub fn is_connection_alive(&self) -> bool
pub fn is_connection_alive(&self) -> bool
Whether the reader task is alive.
Sourcepub fn inbound_dropped(&self) -> u64
pub fn inbound_dropped(&self) -> u64
Count of dropped inbound frames under backpressure.
Sourcepub async fn disconnect_cause(&self) -> Option<DisconnectCause>
pub async fn disconnect_cause(&self) -> Option<DisconnectCause>
Disconnect cause if disconnected.
Sourcepub async fn wait_disconnected(&self) -> DisconnectCause
pub async fn wait_disconnected(&self) -> DisconnectCause
Wait until disconnected.
Sourcepub async fn connect(&self) -> Result<()>
pub async fn connect(&self) -> Result<()>
Dial + handshake (connection_init / connection_ack ready).
Sourcepub async fn send_envelope(&self, env: Envelope) -> Result<()>
pub async fn send_envelope(&self, env: Envelope) -> Result<()>
Send a raw envelope.
Sourcepub async fn notify(
&self,
method: &str,
params: Map<String, Value>,
) -> Result<()>
pub async fn notify( &self, method: &str, params: Map<String, Value>, ) -> Result<()>
Fire-and-forget notification.
Sourcepub async fn request(
&self,
method: &str,
params: Map<String, Value>,
req_timeout: Duration,
) -> Result<Map<String, Value>>
pub async fn request( &self, method: &str, params: Map<String, Value>, req_timeout: Duration, ) -> Result<Map<String, Value>>
RPC request correlated by id.
Sourcepub async fn request_response(
&self,
payload: Map<String, Value>,
fallback_method: &str,
req_timeout: Duration,
) -> Result<Map<String, Value>>
pub async fn request_response( &self, payload: Map<String, Value>, fallback_method: &str, req_timeout: Duration, ) -> Result<Map<String, Value>>
Legacy-shaped request map (type → method) like Go RequestResponse.
Sourcepub async fn subscribe(
&self,
method: &str,
params: Map<String, Value>,
req_timeout: Duration,
) -> Result<String>
pub async fn subscribe( &self, method: &str, params: Map<String, Value>, req_timeout: Duration, ) -> Result<String>
Subscribe; returns subscription id.
Sourcepub async fn unsubscribe(&self, id: &str) -> Result<()>
pub async fn unsubscribe(&self, id: &str) -> Result<()>
Unsubscribe by id.
Sourcepub async fn read_event(&self) -> Result<Option<Value>>
pub async fn read_event(&self) -> Result<Option<Value>>
Read next inbound app event (blocks).
Sourcepub async fn read_event_with_timeout(
&self,
dur: Duration,
) -> Result<Option<Value>>
pub async fn read_event_with_timeout( &self, dur: Duration, ) -> Result<Option<Value>>
Read with timeout; None on timeout.
Sourcepub async fn clear_pending_events(&self)
pub async fn clear_pending_events(&self)
Clear pending inbound events.
Sourcepub async fn peel_stale_pending_control_events(&self) -> Vec<String>
pub async fn peel_stale_pending_control_events(&self) -> Vec<String>
Peel stale pending control frames at turn start.
Sourcepub async fn send_input(&self, text: &str, opts: SendInputOptions) -> Result<()>
pub async fn send_input(&self, text: &str, opts: SendInputOptions) -> Result<()>
Notify loop_input.
Sourcepub async fn loop_new(
&self,
params: Map<String, Value>,
) -> Result<Map<String, Value>>
pub async fn loop_new( &self, params: Map<String, Value>, ) -> Result<Map<String, Value>>
loop_new RPC.
Sourcepub async fn loop_subscribe(
&self,
loop_id: &str,
stream_delivery: &str,
) -> Result<String>
pub async fn loop_subscribe( &self, loop_id: &str, stream_delivery: &str, ) -> Result<String>
Subscribe to loop_events.
Sourcepub async fn loop_cards_fetch(
&self,
loop_id: &str,
) -> Result<Map<String, Value>>
pub async fn loop_cards_fetch( &self, loop_id: &str, ) -> Result<Map<String, Value>>
loop_cards_fetch.
Sourcepub async fn loop_history_fetch(
&self,
loop_id: &str,
) -> Result<Map<String, Value>>
pub async fn loop_history_fetch( &self, loop_id: &str, ) -> Result<Map<String, Value>>
loop_history_fetch.
Sourcepub async fn loop_messages(
&self,
loop_id: &str,
limit: u32,
offset: u32,
) -> Result<Map<String, Value>>
pub async fn loop_messages( &self, loop_id: &str, limit: u32, offset: u32, ) -> Result<Map<String, Value>>
loop_messages.
Sourcepub async fn loop_state_get(&self, loop_id: &str) -> Result<Map<String, Value>>
pub async fn loop_state_get(&self, loop_id: &str) -> Result<Map<String, Value>>
loop_state_get.
Sourcepub async fn invoke_skill(
&self,
skill: &str,
args: &str,
) -> Result<Map<String, Value>>
pub async fn invoke_skill( &self, skill: &str, args: &str, ) -> Result<Map<String, Value>>
invoke_skill on this connection (stream socket for turn enqueue).
Sourcepub async fn reattach_and_probe(&self, loop_id: &str) -> Result<()>
pub async fn reattach_and_probe(&self, loop_id: &str) -> Result<()>
Reattach + subscribe + loop_get probe.