Skip to main content

Module client

Module client 

Source
Expand description

RPC client (operates uniformly in native and WASM-browser environments).

§TLS crypto provider (native)

Secure (wss://) RPC connections on native targets go through workflow-websockettungsteniterustls, which (since 0.23) requires a process-level crypto provider to be installed before the first connection — typically by the application or a higher-level SDK at startup:

rustls::crypto::ring::default_provider().install_default().unwrap();

If exactly one rustls provider is compiled into the binary, it is selected automatically and no explicit install is needed; an install is only required when none — or more than one — provider is present. In the browser/WASM environment the host WebSocket handles TLS, so no provider is required.

Re-exports§

pub use crate::client::error::Error;
pub use crate::client::result::Result;

Modules§

error
Client Error enum declaration
prelude
Convenience module exporting all types required for the client use.
result
Client Result enum encapsulating client Error

Macros§

notification
notification!() macro for declaration of RPC notification handlers

Structs§

BorshProtocol
Borsh RPC message handler and dispatcher
ConnectOptions
ConnectOptions is used to configure the WebSocket connectivity behavior.
Interface
Collection of server-side notification handlers
JsonProtocol
Serde JSON RPC message handler and dispatcher
Notification
A typed notification handler that deserializes an inbound Msg payload (from Borsh or JSON) and invokes the wrapped async callback with it.
Options
Configuration options used when constructing an RpcClient.
RpcClient
wRPC client capable of issuing requests and notifications and dispatching server-side notifications over a WebSocket connection using either the Borsh or JSON protocol. Ops is the application operation enum and Id is the message identifier type.
WebSocketConfig
Configuration struct for WebSocket client (native Tungstenite and NodeJs connections only)

Enums§

ConnectStrategy
ConnectionStrategy specifies how the WebSocket async fn connect() function should behave during the first-time connectivity phase. @category WebSocket
Ctl
Client connection lifecycle event broadcast through the control multiplexer.

Traits§

NotificationHandler
Handler invoked with the raw payload of an inbound server notification.
Resolver
Trait implemented by URL resolvers that supply the destination URL dynamically when no explicit URL has been configured.

Type Aliases§

ConnectResult
Result of a connect attempt. On success yields Some(receiver) when the caller did not block on the connection (the receiver fires once connected), or None when the connect call blocked until the connection was established.
ResolverResult
Result of a Resolver::resolve_url call, yielding the destination URL.
WebSocketError
Alias for the WebSocket client Error type.