libp2p_pubsub_core/event.rs
1use libp2p::identity::PeerId;
2
3use crate::message::Message;
4
5/// This enum represents events that can be emitted by the pubsub
6/// [`Behaviour`](super::behaviour::Behaviour).
7#[derive(Debug)]
8pub enum Event {
9 /// Emitted by the pubsub behaviour when a message associated with a topic the node is
10 /// subscribed to is received.
11 MessageReceived {
12 /// Peer that propagated the message.
13 ///
14 /// Do not confuse with the original author of the message, which is optionally included in
15 /// the message itself in the message's `from` field.
16 /// field.
17 src: PeerId,
18 /// The message itself.
19 message: Message,
20 },
21}