Connect two peer in nodeJS using Relay Circuit

Hi there, I’m kind of new in libp2p ecosystem, but I’ve been playing with example in Rust, Go, and Javascript.
I want to have desktop applications be able to talk to each other, the plan will be to use a Relay to avoid any NAT issues.

I would like to connect Alice and Bob, both NodeJS client by using a custom relay (in golang)
I know my relay are operational because I made it work by splitting dialer/listener from the Go example code.

Regarding NodeJS Implementation I’m kind of lost, and I’m 10 times much experienced in JS.
The implementation in Go are logic and straight forward.

  1. Create a handler for each peers Alice and Bob
  2. Declare Alice to discover other peers from the relay.
  3. Connect both Alice and Bob peer to RELAY
  4. Connect Alice to Bob using /p2p-circuit/ multi-address
  5. Create a stream protocol /cat with PeerID Bob
  6. Enjoy the success working message printed on Bob when Alice dial

But in Javascript I’m confused, some say the relay can be automatically handled,
but the example is incomplete and show the creation of listener/dialer using Circuit object.

It’s different than using traditional Node listener because we have to manage Swarm
which is now known as Switch and the lack of documentation found led me to reverse-engine the code to try to figure it out.

I don’t know if I must used Circuit inside the Node transports definition or not.
It should seems natural to me that peerBook are enough to connect nodes.

There are the echo code example I’m trying to make it work
Alice Peer:
Bob Peer (dialer):


There is the node file because I can only post two link on topic creation