use std::time::Duration;
use waapi_rs::{ak, WaapiClient};
#[tokio::main]
async fn main() {
env_logger::init();
loop {
match WaapiClient::connect().await {
Ok(client) => {
println!("Connected to Wwise.");
let sub_result = client
.subscribe(ak::wwise::ui::SELECTION_CHANGED, None, |kwargs| {
println!("Selection changed: {kwargs:#?}");
})
.await;
if let Err(e) = sub_result {
eprintln!("Failed to subscribe: {e}");
}
while client.is_connected() {
tokio::time::sleep(Duration::from_secs(1)).await;
println!("Still connected...");
}
println!("Disconnected from Wwise.");
}
Err(e) => {
eprintln!("Failed to connect: {e}");
}
}
tokio::time::sleep(Duration::from_secs(5)).await;
println!("Attempting to reconnect...");
}
}