I’m trying to build a system made of 2 nodes:
- go-ipfs node
- js-ipfs node inside a browser
The code for the POC is https://github.com/ido-ran/ipfs-pubsub-poc1
You can start the go-ipfs with ./run-daemon.sh and subscribe to the topic using ./sub.sh.
The browser startup and you can publish a message with pub
button.
I was expecting this POC to work as it, but it doesn’t. It only works if I find the address of the go-ipfs using ipfs id
and add it to the js-ipfs
app. You can see the commented out lines of node.swarm.connect
. Once I connect directly to that node it works and I can see the published message in the console window.
Also, I see that both nodes connect to at least one shared node in the swarm. I use ipfs swar addrs
on the command line to list the swarm and the getId
button actually list the js-ipfs node’s swarm. I thought having at least one common node means the pubsub message should arrive but it doesn’t look like that.
The whole point of using pubsub is to not know the exact address of the other node. Am I missing something or this scenario should not work?