Can't discover peers with webrtc-star on js-libp2p@0.37.0

Hello,

since i have upgraded to js-libp2p@0.37.0 i can’t discover peers with webrtc-star.

As a signalling server i use the libp2p/js-libp2p-webrtc-star docker image (latest).

With previous libp2p version this setup used to work. I could discover all other nodes.

With the new version i don’t get any discover events from other nodes.
What i can do however is to successfully dial other nodes via the webrtc-star docker server.

await libp2p.node.dial("/dns4/webrtc-xxxxxxxx.de/tcp/443/wss/p2p-webrtc-star/p2p/QmTtFjYz56Pfzg88fgUp75JzskFmd7m5dbiTKbgA3imEVa");

So i think generally it is setup correctly.

Below is how my libp2p nodes are configured. Is there any configuration that I am missing?

import {createLibp2p} from "libp2p";
import {WebSockets} from "@libp2p/websockets";
import {Noise} from "@chainsafe/libp2p-noise";
import {Mplex} from "@libp2p/mplex";
import {KadDHT} from "@libp2p/kad-dht";
import {GossipSub} from "@chainsafe/libp2p-gossipsub";
import {WebRTCStar} from "@libp2p/webrtc-star";
import wrtc from "wrtc";

...

  var node = await createLibp2p( {
    peerId: id,
    transports: [
      new WebSockets(),
      new WebRTCStar({wrtc: wrtc})
    ],
    connectionEncryption: [new Noise()],
    streamMuxers: [new Mplex()],
    dht: new KadDHT(),
    pubsub: new GossipSub(),
    addresses: {
      listen: [
        "/dns4/webrtc-xxxxxxxx.de/tcp/443/wss/p2p-webrtc-star"
      ]
    },
  }) 

...

this.node.addEventListener("peer:discovery", (myevent) => {onDiscovery.onDiscovery(myevent)});
this.node.connectionManager.addEventListener("peer:connect", (myevent) => {onConnect.onConnect(myevent)});

And here are the versions from package.json

"libp2p": "^0.37.0",
"@libp2p/websockets": "^1.0.8",
"@chainsafe/libp2p-noise": "^6.1.1",
"@libp2p/mplex": "^1.0.5",
"@libp2p/kad-dht": "^1.0.12",
"@chainsafe/libp2p-gossipsub": "^1.0.0",
"@libp2p/webrtc-star": "^1.0.10",
"wrtc": "^0.4.7",

Regards Sneaker

I managed to get it working - somehow

First i had to add a custom EventListener to catch the “peer” event from webrtc-star and then fire the onDiscoveryPeer function to get the regular “peer:discovery” event.

node.components.getTransportManager().transports.get("@libp2p/webrtc-star").discovery.addEventListener('peer', evt => {
      this.node.onDiscoveryPeer(evt);
  });

Additionally i had to start the discovery service of webrtc-star manually as it is not started by default.

await libp2p.node.components.getTransportManager().transports.get("@libp2p/webrtc-star").discovery.start();

But this can not be the way it is meant to work.
So is this a bug or is there a way to pass a configuration object to the libp2pInit. Maybe in peerDiscovery?