How to send messages using libp2p through a functions in Rust? #5505
-
I'm working on a Rust project where I need to send and receive messages using libp2p. My question is: How can I send a gossip message from a function outside of the process_messages loop? I'm looking for a way to create a separate sender that can be called to send messages independently of the receiving loop. Any guidance or code examples would be greatly appreciated!
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you want something flexible and high-level then I suggest you to have the libp2p loop in a task and communicate with it with channels. I'm personally using the Actors with Tokio pattern. You can check the code of the project I'm working on. |
Beta Was this translation helpful? Give feedback.
If you want something flexible and high-level then I suggest you to have the libp2p loop in a task and communicate with it with channels. I'm personally using the Actors with Tokio pattern. You can check the code of the project I'm working on.