pub struct RealtimeClient { /* private fields */ }Expand description
SignalR-over-WebSocket client for one ProjectX hub.
The transport owns no subscription truth. Reconnects emit
RealtimeEvent::Reconnected, after which the caller replays its current
subscription set.
Implementations§
Source§impl RealtimeClient
impl RealtimeClient
Sourcepub fn take_event_receiver(&self) -> Option<RealtimeEventReceiver>
pub fn take_event_receiver(&self) -> Option<RealtimeEventReceiver>
Claims this client’s single event receiver.
Sourcepub async fn connect(&self) -> Result<(), RealtimeError>
pub async fn connect(&self) -> Result<(), RealtimeError>
Connects and validates the SignalR handshake.
§Errors
Returns an error when authentication, URL construction, WebSocket
upgrade, or the SignalR handshake fails.
Sourcepub async fn disconnect(&self) -> Result<(), RealtimeError>
pub async fn disconnect(&self) -> Result<(), RealtimeError>
Gracefully disconnects and stops background tasks.
§Errors
Returns an error if the close handshake does not complete within the bounded timeout.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns whether the latest connection completed its SignalR handshake.
Sourcepub fn session(&self) -> Result<RealtimeSession, RealtimeError>
pub fn session(&self) -> Result<RealtimeSession, RealtimeError>
Captures the current socket for generation-scoped subscription admission.
§Errors
Returns RealtimeError::NotConnected unless a socket is ready.
Sourcepub async fn invoke(
&self,
target: impl Into<String>,
arguments: Vec<Value>,
) -> Result<(), RealtimeError>
pub async fn invoke( &self, target: impl Into<String>, arguments: Vec<Value>, ) -> Result<(), RealtimeError>
Invokes an arbitrary provider target and waits for its completion frame.
§Errors
Returns an error when disconnected, a bounded capacity is exhausted, the provider rejects the invocation, or completion times out. A timeout or cancellation after queue admission has an unknown outcome and reclaims only that invocation slot. It never closes the connection or retries the call.