I’m struggling hard to achive smooth communication between nodes. Now I need to solve such problem.
I’ve many js-ipfs nodes and Kubo nodes as well, all of them connected to public Kubo node(aka master) 1-to-1 using swarm connect.
The question is how I can broadcast some message from one node to others using master node as intermediary?
Literally I send message into my swarm(now here is only my node and master-node) and expect that master node will broadcast my message to all peers that connected to it.
Try those steps:
Establish a connection between each of your nodes and the master node using swarm connect. This will create a peer-to-peer network.
Use the PubSub feature of IPFS to publish the message from the node that needs to broadcast it. This will send the message to the master node.
The master node can subscribe to the topic of the message using PubSub and receive the message.
Once the master node receives the message, it can publish it to the same topic using PubSub. This will ensure that all nodes that have subscribed to the topic receive the message.
Each node that has subscribed to the topic using PubSub will receive the message and can take appropriate action based on the content of the message.
Ok, that’s clear. But how to achieve such behaviour? literally hot to “tell” master node to broadcast all incoming messages? Config, or some plugin is necessary?
If you subscribe to the same topic on the master node, it will relay messages to other subscribed peers on it’s own.