pub trait SignalingClient: Send + Sync {
Show 19 methods
// Required methods
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_register_request<'life0, 'async_trait>(
&'life0 self,
request: RegisterRequest,
) -> Pin<Box<dyn Future<Output = NetworkResult<RegisterResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_unregister_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
reason: Option<String>,
) -> Pin<Box<dyn Future<Output = NetworkResult<UnregisterResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_heartbeat<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
availability: ServiceAvailabilityState,
power_reserve: f32,
mailbox_backlog: f32,
) -> Pin<Box<dyn Future<Output = NetworkResult<Pong>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_route_candidates_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
request: RouteCandidatesRequest,
) -> Pin<Box<dyn Future<Output = NetworkResult<RouteCandidatesResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_signing_key<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
key_id: u32,
) -> Pin<Box<dyn Future<Output = NetworkResult<(u32, Vec<u8>)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_credential_update_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
) -> Pin<Box<dyn Future<Output = NetworkResult<RegisterResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_envelope<'life0, 'async_trait>(
&'life0 self,
envelope: SignalingEnvelope,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn receive_envelope<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<Option<SignalingEnvelope>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_connected(&self) -> bool;
fn get_stats(&self) -> SignalingStats;
fn subscribe_events(&self) -> Receiver<SignalingEvent>;
fn set_actor_id<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_credential_state<'life0, 'async_trait>(
&'life0 self,
credential_state: CredentialState,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clear_identity<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn connect_once<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn probe_alive<'life0, 'async_trait>(
&'life0 self,
_timeout: Duration,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn set_hook_callback(
&self,
_cb: Arc<dyn Fn(HookEvent) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>,
) { ... }
}Expand description
signaling client connect port
§interior mutability
allMethodusing &self and non &mut self, with for conveniencein Arc in shared.
Implementation class needs interior mutability ( like Mutex)to manage WebSocket connection status.
Required Methods§
Sourcefn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connecttosignaling server
Sourcefn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
DisconnectConnect
Sourcefn send_register_request<'life0, 'async_trait>(
&'life0 self,
request: RegisterRequest,
) -> Pin<Box<dyn Future<Output = NetworkResult<RegisterResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_register_request<'life0, 'async_trait>(
&'life0 self,
request: RegisterRequest,
) -> Pin<Box<dyn Future<Output = NetworkResult<RegisterResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deprecated: Registration now happens via AIS HTTP; this WS path is no longer used. Kept for backward compatibility; will be removed in a future release.
Sourcefn send_unregister_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
reason: Option<String>,
) -> Pin<Box<dyn Future<Output = NetworkResult<UnregisterResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_unregister_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
reason: Option<String>,
) -> Pin<Box<dyn Future<Output = NetworkResult<UnregisterResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send UnregisterRequest to signaling server (Actr → Signaling flow)
This is used when an Actor is shutting down gracefully and wants to proactively notify the signaling server that it is no longer available.
Sourcefn send_heartbeat<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
availability: ServiceAvailabilityState,
power_reserve: f32,
mailbox_backlog: f32,
) -> Pin<Box<dyn Future<Output = NetworkResult<Pong>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_heartbeat<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
availability: ServiceAvailabilityState,
power_reserve: f32,
mailbox_backlog: f32,
) -> Pin<Box<dyn Future<Output = NetworkResult<Pong>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send center skip(Registerafter stream process, using ActrToSignaling) Returns Pong response if received, error if timeout or no response
Sourcefn send_route_candidates_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
request: RouteCandidatesRequest,
) -> Pin<Box<dyn Future<Output = NetworkResult<RouteCandidatesResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_route_candidates_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
request: RouteCandidatesRequest,
) -> Pin<Box<dyn Future<Output = NetworkResult<RouteCandidatesResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send RouteCandidatesRequest (requires authenticated Actor session)
Sourcefn get_signing_key<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
key_id: u32,
) -> Pin<Box<dyn Future<Output = NetworkResult<(u32, Vec<u8>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_signing_key<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
key_id: u32,
) -> Pin<Box<dyn Future<Output = NetworkResult<(u32, Vec<u8>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Query AIS Ed25519 signing public key via signaling
Returns (key_id, pubkey_bytes) where pubkey_bytes is the 32-byte raw public key.
Typically called by AisKeyCache on cache miss; should not be used directly in hot paths.
Sourcefn send_credential_update_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
) -> Pin<Box<dyn Future<Output = NetworkResult<RegisterResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_credential_update_request<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
credential: AIdCredential,
) -> Pin<Box<dyn Future<Output = NetworkResult<RegisterResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send CredentialUpdateRequest to refresh the Actor’s credential
This is used to refresh the credential before it expires. The server responds with a RegisterResponse containing the new credential and expiration time.
Sourcefn send_envelope<'life0, 'async_trait>(
&'life0 self,
envelope: SignalingEnvelope,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_envelope<'life0, 'async_trait>(
&'life0 self,
envelope: SignalingEnvelope,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sendsignalingsignal seal ( pass usage Method)
Sourcefn receive_envelope<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<Option<SignalingEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive_envelope<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<Option<SignalingEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receivesignalingsignal seal
Sourcefn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check connection status
Sourcefn get_stats(&self) -> SignalingStats
fn get_stats(&self) -> SignalingStats
GetConnect statistics info
Sourcefn subscribe_events(&self) -> Receiver<SignalingEvent>
fn subscribe_events(&self) -> Receiver<SignalingEvent>
Subscribe to signaling events (state transitions).
Sourcefn set_actor_id<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_actor_id<'life0, 'async_trait>(
&'life0 self,
actor_id: ActrId,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set actor ID and credential state for reconnect URL parameters.
fn set_credential_state<'life0, 'async_trait>(
&'life0 self,
credential_state: CredentialState,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn clear_identity<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_identity<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear stored actor ID and credential state.
After calling this, connect() will produce a clean WebSocket URL
without identity query parameters, so the signaling server treats
the connection as brand-new rather than a reconnect of the old actor.
This is required before re-registration when the credential has expired.
Provided Methods§
Sourcefn connect_once<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect_once<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a single explicit connection attempt.
Network recovery events use this path so a failed restore attempt can return quickly instead of sleeping inside the normal reconnect backoff.
Sourcefn probe_alive<'life0, 'async_trait>(
&'life0 self,
_timeout: Duration,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn probe_alive<'life0, 'async_trait>(
&'life0 self,
_timeout: Duration,
) -> Pin<Box<dyn Future<Output = NetworkResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Probe whether the existing signaling WebSocket is truly alive.
The default implementation only checks local state. WebSocket-backed clients override this with an active Ping/Pong probe to catch half-open sockets before network recovery decides whether to reconnect.
Sourcefn set_hook_callback(
&self,
_cb: Arc<dyn Fn(HookEvent) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>,
)
fn set_hook_callback( &self, _cb: Arc<dyn Fn(HookEvent) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>, )
Set a lifecycle hook callback that will be invoked (and awaited) whenever signaling state changes (connect/disconnect). Default implementation is a no-op for clients that don’t support hooks.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".