I created an IPFS private network. Whenever someone uploads a new file, all the nodes in the network should be notified. Does anyone have any idea how to achieve this?
Asked
Active
Viewed 155 times
0
-
i don't think that IPFS provide somethings like that with the node, maybe there is somethings with the JS API or Go API – vincenzopalazzo Apr 03 '21 at 17:54
1 Answers
1
You can look into the pubsub mechanism:
First, you’ll need to enable the pubsub code. Make sure you’re running go-ipfs 0.4.5 or above. Once you have that version of ipfs installed, start the daemon with:
ipfs daemon --enable-pubsub-experiment
This will tell ipfs to create and enable the pubsub service. It also implies that you will only be able to use pubsub with other peers who choose to enable it.
To subscribe to the topic foo, run:
ipfs pubsub sub foo
Now, any messages for the topic foo will print to your console.
To publish a message to the topic foo, open up another terminal and run:
ipfs pubsub pub foo "hello world"
You should see "hello world" printed out in the first terminal.
Source: Take a look at pubsub on IPFS
Also see: ipfs name pubsub
| Command-line reference | IPFS Docs

Bora M. Alper
- 3,538
- 1
- 24
- 35