Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm
1# fork of the awesome jetstream-oxide 2 3fork note: this readme is likely a bit out of date! i've been messing around with some apis. 4 5A typed Rust library for easily interacting with and consuming the 6Bluesky [Jetstream](https://github.com/bluesky-social/jetstream) 7service. 8 9```rust 10let config = JetstreamConfig { 11 endpoint: DefaultJetstreamEndpoints::USEastOne.into(), 12 compression: JetstreamCompression::Zstd, 13 ..Default::default() 14}; 15 16let jetstream = JetstreamConnector::new(config).unwrap(); 17let receiver = jetstream.connect().await?; 18 19while let Ok(event) = receiver.recv_async().await { 20 if let Commit(commit) = event { 21 match commit { 22 CommitEvent::Create { info, commit } => { 23 println!("Received create event: {:#?}", info); 24 } 25 CommitEvent::Update { info, commit } => { 26 println!("Received update event: {:#?}", info); 27 } 28 CommitEvent::Delete { info, commit } => { 29 println!("Received delete event: {:#?}", info); 30 } 31 } 32 } 33} 34``` 35 36## Example 37 38A small example CLI utility to show how to use this crate can be found in the `examples` directory. To run it, use the 39following command: 40 41```sh 42cargo run --example basic -- --nsid "app.bsky.feed.post" 43``` 44 45This will display a real-time feed of every single post that is being made or deleted in the entire Bluesky network, 46right in your terminal! 47 48You can filter it down to just specific accounts like this: 49 50```sh 51cargo run --example basic -- \ 52--nsid "app.bsky.feed.post" \ 53--did "did:plc:inze6wrmsm7pjl7yta3oig77" 54``` 55 56This listens for posts that *I personally make*. You can substitute your own DID and make a few test posts yourself if 57you'd 58like of course! 59 60 61## Running `rustfmt` (requires nightly) 62 63```bash 64# get nightly set up 65rustup toolchain install nightly --allow-downgrade -c rustfmt 66# run the nightly version of fmt 67cargo +nightly fmt 68```