diff --git a/examples/light-js/index.html b/examples/light-js/index.html index 02a800d..71f9892 100644 --- a/examples/light-js/index.html +++ b/examples/light-js/index.html @@ -20,11 +20,7 @@
- +Creating Waku node.
"; const node = await createLightNode(); @@ -130,6 +138,21 @@ console.log("Message sent!"); textInput.value = null; }; + + async function searchForPeer(statusNode, multiaddrNode) { + statusDiv.innerHTML = "Discovering peer
"; + + const dnsDiscovery = await DnsNodeDiscovery.dnsOverHttp(); + const peersIterator = await dnsDiscovery.getNextPeer( + [enrTree["TEST"]], + { lightPush: 1, filter: 1 } + ); + const peerEnr = await peersIterator.next(); + const ma = peerEnr.value.multiaddrs.map((v) => v.toString())[1]; + const peerId = peerEnr.value.peerId.toString(); + + multiaddrNode.value = `${ma}/p2p/${peerId}`; + }