Skip to content

Commit

Permalink
add subscribers and example
Browse files Browse the repository at this point in the history
  • Loading branch information
mycognosist committed Feb 21, 2024
1 parent 689b6ed commit 4d4cb70
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions solar_client/examples/subscribers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use anyhow::Result;
use solar_client::{Client, SolarClient};

const SERVER_ADDR: &str = "http://127.0.0.1:3030";
const CHANNEL: &str = "myco";

#[tokio::main]
async fn main() -> Result<()> {
let client = Client::new(SERVER_ADDR.to_owned())?;

let subscribers = client.subscribers(CHANNEL).await?;
println!("{:#?}", subscribers);
// [
// "@HEqy940T6uB+T+d9Jaa58aNfRzLx9eRWqkZljBmnkmk=.ed25519",
// ]

Ok(())
}
2 changes: 2 additions & 0 deletions solar_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub trait SolarClient {

async fn ping(&self) -> String;

async fn subscribers(&self, channel: &str) -> Vec<String>;

async fn whoami(&self) -> String;
}

Expand Down

0 comments on commit 4d4cb70

Please sign in to comment.