Hi,
I am working on a webcam application using libp2p. To find the peers, I tried the below libp2p code but it didn’t worked for me. .
App.js Code
const SIGNAL_SERVER = '/ip4/127.0.0.1/ws/p2p-webrtc-star/ipfs/:peer-id'
const node = new Node({peerInfo})
// start libp2p
node.start((err) => {
console.log("in start node");
if (err) callback(err)
callback(null, node)
})
...........
............
class Node extends libp2p {
//The options to use when generating the libp2p node
constructor (peerInfo, peerBook, options) {
options = options || {}
const wstar = new WebRTCStar({ wrtc })
// The libp2p modules for this libp2p bundle
const defaults = {
modules: {
transport: [ new WS(), wstar ],
streamMuxer: [ mplex ],
connEncryption: [ secio ],
peerDiscovery: [wstar.discovery ],
}
}
super(defaultsDeep(defaults,peerInfo,peerBook,options))
}
}
.............
.................
node.on('peer:discovery', (peerInfo) => {
console.log('Peer Discovered:')
})
It didn’t displays any error but the peers are not discovering each other. Please help me to resolve this error.
Environment
Npm:6.13.4
Node:10.18.1
Os: ubuntu 18.04
Libp2p: 0.25.4