What is it event?

Guys, hi, I am beginner in this field, and I have one questions, what I need use event? For example, if I check github repo, and open file chat.rs, I see this code:

    #[behaviour(out_event = "OutEvent")]
    struct MyBehaviour {
        floodsub: Floodsub,
        mdns: Mdns,

        // Struct fields which do not implement NetworkBehaviour need to be ignored
        ignored_member: bool,

    enum OutEvent {

    impl From<MdnsEvent> for OutEvent {
        fn from(v: MdnsEvent) -> Self {

    impl From<FloodsubEvent> for OutEvent {
        fn from(v: FloodsubEvent) -> Self {

Can you explain me, why we should create NetworkBehaviour and after that we create enum with it and writing impl for Mdns and Floodsub event thanks) I’ve read Ping Pong tutorial, but there I don’t find how and why I use should event’s

Hi @Act0r1,

I am not sure I understand your question.

After the ping pong tutorial, a good next read is the NetworkBehaviour documentation.