sugyan / atrium

Rust libraries for Bluesky's AT Protocol services.
MIT License
179 stars 18 forks source link

Subscribe repos example? #11

Closed Captain-Of-Coit closed 1 year ago

Captain-Of-Coit commented 1 year ago

Regarding atrium-api/src/com/atproto/sync/subscribe_repos.rs

It would be great to see some sort of example on how to use this. From brief reading of the code, it seems to not be implemented yet, as I cannot find anything regarding reading streams, events or anything like that. Is that correct?

sugyan commented 1 year ago

Unfortunately, the subscription feature is not yet implemented. I would like to use it too and will do my best to implement it. 😵‍💫

timfpark commented 1 year ago

@sugyan If there are notes on how to implement it (and you are accepting contributors) I would be interested in helping. Thanks for all of your hard work on the library - really works well for being so early.

timfpark commented 1 year ago

If it is helpful, I did some prototyping work with decoding the firehose here:

https://github.com/timfpark/firehose-prototype/blob/main/src/main.rs

I've made it through the Header, Commit, and RepoOp structures after evaluating a bunch of CBOR deserializers and landing on ciborium in conjunction with serde. The principal challenge from here is decoding the CAR file in the commit.

There is a CAR decoder here https://github.com/dapplion/rs-car/tree/master.

Hopefully this is helpful.

sugyan commented 1 year ago

Oooh very cool prototype implementation, thank you! I will try to implement something like this with your codes as a reference!

benwis commented 1 year ago

Bisky has methods for reading records from the firehose that are working, see here: https://github.com/jesopo/bisky/tree/jess/firehose

sugyan commented 1 year ago

I've merged #15 which includes firehose example. There is still an issue with images embedding not being deserialized correctly, but I think it should work correctly for just extracting texts.