improve telemetry ergonomics
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use api::client::command::Commanding;
|
||||
use api::client::command::CommandRegistry;
|
||||
use api::client::Client;
|
||||
use api::macros::IntoCommandDefinition;
|
||||
use api::messages::command::CommandHeader;
|
||||
@@ -20,13 +20,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||
});
|
||||
}
|
||||
|
||||
let client = Arc::new(Client::connect("ws://[::1]:8080/backend")?);
|
||||
let client = Arc::new(Client::connect("ws://localhost:8080/backend")?);
|
||||
let cmd = CommandRegistry::new(client);
|
||||
|
||||
let handle =
|
||||
Commanding::register_handler(client, "simple_command/a".to_string(), handle_command);
|
||||
let handle = cmd.register_handler("simple_command/a", handle_command);
|
||||
|
||||
cancellation_token.cancelled().await;
|
||||
|
||||
// This will automatically drop when we return
|
||||
drop(handle);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user