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:

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

        // Struct fields which do not implement NetworkBehaviour need to be ignored
        #[behaviour(ignore)]
        #[allow(dead_code)]
        ignored_member: bool,
    }

    #[allow(clippy::large_enum_variant)]
    #[derive(Debug)]
    enum OutEvent {
        Floodsub(FloodsubEvent),
        Mdns(MdnsEvent),
    }

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

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

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.