From f27cda7d88566e3dbd1186c122c6bde8f677c6f9 Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande Date: Sun, 22 Dec 2024 14:42:09 +0100 Subject: [PATCH] tic-tac-toe main add some more comments --- examples/tic-tac-toe-gui/src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/tic-tac-toe-gui/src/main.rs b/examples/tic-tac-toe-gui/src/main.rs index b298c0d..5fdd951 100644 --- a/examples/tic-tac-toe-gui/src/main.rs +++ b/examples/tic-tac-toe-gui/src/main.rs @@ -90,10 +90,17 @@ impl TicTacToeApp { // Subscribe to desired topic using the relay protocol waku.relay_subscribe(&self.game_topic).await.expect("waku should subscribe"); + /// Example filter subscription. This is needed in edge nodes (resource-restricted devices) + /// Nodes usually use either relay or lightpush/filter protocols + // let ctopic = WakuContentTopic::new("waku", "2", "tictactoegame", Encoding::Proto); // let content_topics = vec![ctopic]; // waku.filter_subscribe(&self.game_topic, content_topics).await.expect("waku should subscribe"); + /// End filter example ---------------------------------------- + + /// Example to establish direct connection to a well-known node + // Connect to hard-coded node // let target_node_multi_addr = // "/ip4/159.223.242.94/tcp/30303/p2p/16Uiu2HAmAUdrQ3uwzuE4Gy4D56hX6uLKEeerJAnhKEHZ3DxF1EfT" @@ -104,6 +111,8 @@ impl TicTacToeApp { // self.waku.connect(&target_node_multi_addr, None) // .expect("waku should connect to other node"); + /// End example direct connection + TicTacToeApp { game_state: self.game_state, waku: waku, @@ -137,7 +146,11 @@ impl TicTacToeApp { dbg!(format!("message hash published: {}", msg_hash)); } + /// Example lightpush publish message. This is needed in edge nodes (resource-restricted devices) + /// Nodes usually use either relay or lightpush/filter protocols + /// // self.waku.lightpush_publish_message(&message, &self.game_topic); + /// End example lightpush publish message ------------------------------- } fn make_move(&mut self, row: usize, col: usize) {