Skip to content

Commit

Permalink
cleanup example
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherry committed Oct 8, 2024
1 parent e8131e0 commit 217e3dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions examples/rpc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ use rand::Rng;
use serde_json::{json, Value};
use std::sync::Arc;

// Example usage of RPC calls between participants
// (In a real app, you'd have one participant per client/device such as an agent and a browser app)
//
// Try it with `LIVEKIT_URL=<url> LIVEKIT_API_KEY=<your-key> LIVEKIT_API_SECRET=<your-secret> cargo run`

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
env_logger::init();
Expand Down Expand Up @@ -88,7 +93,7 @@ async fn perform_square_root(room: &Arc<Room>) -> Result<(), Box<dyn std::error:
let parsed_response: Value = serde_json::from_str(&response)?;
println!("[Requester] Nice, the answer was {}", parsed_response["result"]);
},
Err(e) => println!("[Requester] RPC call failed: {:?}", e),
Err(e) => log::error!("[Requester] RPC call failed: {:?}", e),
}
Ok(())
}
Expand All @@ -105,7 +110,7 @@ async fn perform_quantum_hypergeometric_series(room: &Arc<Room>) -> Result<(), B
println!("[Requester] Aww looks like the genius doesn't know that one.");
return Ok(());
}
println!("[Requester] RPC error: {} (code: {})", e.message, e.code);
log::error!("[Requester] RPC error: {} (code: {})", e.message, e.code);
},
}
Ok(())
Expand Down

0 comments on commit 217e3dd

Please sign in to comment.