ipfs-rust / ipfs-embed

A small embeddable ipfs implementation
344 stars 47 forks source link

pubsub subscribe: expose originating peer id for each message #89

Closed wngr closed 2 years ago

wngr commented 2 years ago

I know this is a breaking change, but I think in most use cases it's extremely useful to have that information. Instead of the tuple we could have a custom struct (also for future extensibility)?

cc @rkuhn

dvc94ch commented 2 years ago

I've been thinking about changing this api recently too. How about returning an enum?

pub enum GossipEvent {
    Subscribed(PeerId),
    Message(PeerId, Vec<u8>),
    Unsubscribed(PeerId),
}