2— Making Your First Nomad Node
Publish and subscribe in Node.js
Start subscribing
Start IPFS:
ipfs daemon
In a new terminal window, start the sample publish code:
node node/publish.js
The publisher will generate an id, print it, and start publishing messages. The publisher stores its identity in files in the directory/store
. If you stop the publisher and run it again, you'll need to delete/store
first.
Copy the publisher id, and editnode/subscribe.js
so that it's subscribing to the id of the publisher you just started.
Now, In a new terminal window, terminal tab, or on another computer, run:
node node/subscribe.js
You should see messages printed every few seconds. 🔥🚀 You just created your first node!
Troubleshooting
Not seeing any messages? Make sure you started IPFS:
ipfs daemon
Still having trouble? Kill Node.js, turn on verbose logging, and try again:
export DEBUG="nomad*"
node subscribe.js