pub struct ClientWrapper { /* private fields */ }Expand description
客户端包装器 — native 使用 HybridClient,WASM 使用 WebSocketClient。
Implementations§
Source§impl ClientWrapper
impl ClientWrapper
pub fn new(client: HybridClient) -> Self
pub async fn connect(&self) -> Result<()>
pub async fn disconnect(&self) -> Result<()>
pub async fn send_frame_and_wait( &self, frame: &Frame, timeout: Duration, ) -> Result<Frame>
pub async fn send_frame(&self, frame: &Frame) -> Result<()>
pub async fn add_observer(&self, observer: ArcObserver)
pub async fn set_event_handler( &self, handler: Option<Arc<dyn ClientEventHandler>>, )
pub async fn is_connected_async(&self) -> bool
pub async fn connection_id_async(&self) -> Option<String>
pub fn active_protocol(&self) -> TransportProtocol
pub async fn with_core<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&ClientCore) -> R,
pub async fn update_heartbeat_config(&self, config: HeartbeatConfig)
pub async fn set_heartbeat_app_state(&self, state: HeartbeatAppState)
pub async fn set_heartbeat_nat_timeout(&self, timeout: Option<Duration>)
pub async fn heartbeat_effective_interval(&self) -> Duration
Sourcepub async fn parser_snapshot(&self) -> MessageParser
pub async fn parser_snapshot(&self) -> MessageParser
获取协商后的消息解析器快照(连接完成后用于解析 ConnectionEvent::Message 原始字节)
Sourcepub async fn wait_for_negotiation(&self, timeout: Duration) -> Result<()>
pub async fn wait_for_negotiation(&self, timeout: Duration) -> Result<()>
等待 CONNECT_ACK 协商完成(不长期占用客户端锁,便于 WASM 侧 drain 入站帧)
Trait Implementations§
Source§impl Clone for ClientWrapper
impl Clone for ClientWrapper
Source§fn clone(&self) -> ClientWrapper
fn clone(&self) -> ClientWrapper
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ClientWrapper
impl !UnwindSafe for ClientWrapper
impl Freeze for ClientWrapper
impl Send for ClientWrapper
impl Sync for ClientWrapper
impl Unpin for ClientWrapper
impl UnsafeUnpin for ClientWrapper
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more