pub struct WsConnection { /* private fields */ }Expand description
通用 WebSocket 连接生命周期管理器
Implementations§
Source§impl WsConnection
impl WsConnection
pub fn new() -> Self
pub fn is_connected(&self) -> bool
pub fn set_retry_policy(&mut self, policy: RetryPolicy)
pub fn set_log_hook<F>(&mut self, hook: F)
pub fn set_log_hook_arc(&mut self, hook: WsLogHook)
pub async fn connect<H>(
&mut self,
reload: bool,
url: &str,
message_handler: H,
) -> Result<(), WebSocketError>where
H: MessageHandler + Clone + 'static,
pub async fn reconnect<H>(
&mut self,
url: &str,
message_handler: H,
) -> Result<(), WebSocketError>where
H: MessageHandler + Clone + 'static,
pub fn disconnect(&mut self)
pub fn send_text(&self, text: &str) -> Result<(), WebSocketError>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for WsConnection
impl !UnwindSafe for WsConnection
impl Forget for WsConnection
impl Freeze for WsConnection
impl Move for WsConnection
impl Send for WsConnection
impl Sync for WsConnection
impl Unpin for WsConnection
impl UnsafeUnpin for WsConnection
Blanket Implementations§
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