peers don't connect automatically through circuit, but they do through websocket-star rendezvous server #1309
Description
- Version:
master
- Platform: Arch Linux and also latest version of Chrome
- Subsystem: libp2p-circuit I think? The problem is with circuit relay
Type: Question
Severity: Medium
Description:
In my application, instances subscribe to a specific pubsub topic and I monitor the peers to see how many of my application's nodes I am connected to.
We are currently using rendezvous servers and websocket-star to connect browser nodes and it works great, however I wanted to try to replace this with connecting to a couple of relay-hop capable js-ipfs nodes via wss and then having browser tabs connect to each other with circuit.
The problem is that with rendezvous servers, the browser peers automatically connect to each other just because they are using the same rendezvous server. I expected the same with circuit, but instead I have to manually dial /p2p-circuit/ipfs/<peerid>
to get the peers to connect.
In short, circuit works but it doesn't automatically connect peers which can't connect directly, while if I use rendezvous it does. This makes rendezvous better in this case even though I understand that circuit is supposed to replace the rendezvous server mechanism, at least for websocket connections.
My Question is, is this expected behavior or missing functionality? How would I recreate the same behavior as websocket-star using circuit and have the peers connect automatically?
Steps to reproduce the error:
- have two peers only listen through a wss rendezvous server
- have them subscribe to the same random pubsub topic
- monitor peers subscribed to the topic to make sure the two nodes see each other
- the nodes automatically see each other at startup, because they connect through the rendezvous server
- do the same thing but instead of using a rendezvous server, have the nodes turn on relay and connect to the same "server" node using wss. The "server" node needs to be relay-hop capable
- note how even after a couple of minutes after starting the three nodes up, the two peers don't see each other in the pubsub topic, but if you dial from one to the other using
/p2p-circuit/ipfs/<peerid>
they connect immediatly and see each other