pub struct MIPClient { /* private fields */ }Expand description
Async MIP protocol client with auto-reconnection support
Implementations§
Source§impl MIPClient
impl MIPClient
pub fn new(options: MIPClientOptions) -> Self
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if the client is connected
Sourcepub fn on_connect<F>(&mut self, callback: F) -> &mut Self
pub fn on_connect<F>(&mut self, callback: F) -> &mut Self
Register connect event callback
Sourcepub fn on_disconnect<F>(&mut self, callback: F) -> &mut Self
pub fn on_disconnect<F>(&mut self, callback: F) -> &mut Self
Register disconnect event callback
Sourcepub fn on_reconnecting<F>(&mut self, callback: F) -> &mut Self
pub fn on_reconnecting<F>(&mut self, callback: F) -> &mut Self
Register reconnecting event callback
Sourcepub fn on_message<F>(&mut self, callback: F) -> &mut Self
pub fn on_message<F>(&mut self, callback: F) -> &mut Self
Register message event callback
Sourcepub async fn disconnect(&mut self) -> MIPResult<()>
pub async fn disconnect(&mut self) -> MIPResult<()>
Disconnect from the server
Sourcepub fn unsubscribe(&self, topic: &str, require_ack: bool) -> MIPResult<u64>
pub fn unsubscribe(&self, topic: &str, require_ack: bool) -> MIPResult<u64>
Unsubscribe from a topic
Sourcepub fn publish(
&self,
topic: &str,
message: &str,
flags: FrameFlags,
) -> MIPResult<u64>
pub fn publish( &self, topic: &str, message: &str, flags: FrameFlags, ) -> MIPResult<u64>
Publish a message to a topic
Sourcepub fn send_raw_frame(
&self,
frame_type: FrameType,
payload: &[u8],
flags: FrameFlags,
) -> MIPResult<u64>
pub fn send_raw_frame( &self, frame_type: FrameType, payload: &[u8], flags: FrameFlags, ) -> MIPResult<u64>
Send raw frame (advanced usage)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MIPClient
impl !RefUnwindSafe for MIPClient
impl Send for MIPClient
impl Sync for MIPClient
impl Unpin for MIPClient
impl UnsafeUnpin for MIPClient
impl !UnwindSafe for MIPClient
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