Skip to content

Commit

Permalink
fix(examples): subscribe to topic in chat-tokio (#3296)
Browse files Browse the repository at this point in the history
With #3097, subscribing to the floodsub topic in `examples/chat-tokio.rs` was removed. I assume this was unintentional (cc @umgefahren), so this PR adds it back.
  • Loading branch information
elenaf9 authored Jan 4, 2023
1 parent 3064096 commit bda1420
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/chat-tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,13 @@ async fn main() -> Result<(), Box<dyn Error>> {

// Create a Swarm to manage peers and events.
let mdns_behaviour = mdns::Behaviour::new(Default::default(), peer_id)?;
let behaviour = MyBehaviour {
let mut behaviour = MyBehaviour {
floodsub: Floodsub::new(peer_id),
mdns: mdns_behaviour,
};

behaviour.floodsub.subscribe(floodsub_topic.clone());

let mut swarm = libp2p_swarm::Swarm::with_tokio_executor(transport, behaviour, peer_id);

// Reach out to another node if specified
Expand Down

0 comments on commit bda1420

Please sign in to comment.