pub trait GmqConnection: Send + Sync {
// Required methods
fn status(&self) -> Status;
fn add_handler(&mut self, handler: Arc<dyn EventHandler>) -> String;
fn remove_handler(&mut self, id: &str);
fn connect(&mut self) -> Result<(), Box<dyn StdError>>;
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
The operations for connections.
Required Methods§
Sourcefn add_handler(&mut self, handler: Arc<dyn EventHandler>) -> String
fn add_handler(&mut self, handler: Arc<dyn EventHandler>) -> String
To add a connection event handler. This will return an identifier for applications to manage handlers.
Sourcefn remove_handler(&mut self, id: &str)
fn remove_handler(&mut self, id: &str)
To remove a handler with an idenfier from GmqConnection::add_handler
.