I’m trying to connect two js-ipfs nodes by connecting both to a libp2p webrtc star exclusively.
Both nodes appear to be connected with the webrtc star, but aren’t connecting with each other.
Only when I open a js-ipfs session in my browser, then it establishes a connection with both nodes (but the nodes don’t seem to connect with each other directly).
Here’s my setup:
-
I created a WebRTC star node by following these instructions.
-
I have two separate servers each running the following js-ipfs instance:
const initIPFSInstance = async () => {
return await IPFS.create({
repo: './.ipfs',
relay: { enabled: true, hop: { enabled: true } },
EXPERIMENTAL: { pubsub: true },
config: {
Addresses: {
Swarm: [
"/dns4/my-webrtc-star.herokuapp.com/tcp/443/wss/p2p-webrtc-star/",
]
}
},
libp2p: {
modules: {
transport: [WebRTCStar]
},
config: {
peerDiscovery: {
webRTCStar: {
enabled: true
}
},
transport: {
WebRTCStar: {
wrtc
}
}
}
}
});
};
Running the nodes I get:
Swarm listening on /dns4/my-webrtc-star.herokuapp.com/tcp/443/wss/p2p-webrtc-star/p2p/12D3KooWR5U7wyqFaBexxxxxxxxxxxxxxxxxyunS2pZUPqR3DAbg
The nodes never sync with each other directly and only seem to connect to browser clients (that also only connect to the WebRTC star).
How do I fix this?