`Hi Team,
I am trying to implement a webcam libp2p application. Inorder to discover the peers
in the same network, i tried the below libp2p code but it didn’t
worked for me. Please help me to resolve this issue.
const
SIGNAL_SERVER
=
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/ipfs/:peer-id'
node
.
on
(
'peer:discovery'
, (
peer
)
=>
{
console.log(‘Discovered:’)
})
Can you share more of your code or at least the configuration you are using? What error are you seeing? Unfortunately there’s not enough information here to diagnose the problem.
App.js Code
const
node
=
new
Node
({
peerInfo
})
node.start((err) => {
if (err) callback(err)
callback(null, node)
})
...
...
class
Node
extends
libp2p
{
constructor (peerInfo, peerBook, options) {
options = options || {}
const wstar = new WebRTCStar()
const defaults = {
modules: {
transport: [ new WS(), wstar ],
streamMuxer: [ mplex ],
connEncryption: [ secio ],
peerDiscovery: [wstar.discovery ]
}
}
super(defaultsDeep(defaults,peerInfo,peerBook,options))
}
}
Environment
Npm version: 6.13.4
Node version: 10.18.1
Os:Ubuntu 18.04
webpack : 3.11.0
babel-loader: 7.1.0
Actually it didn’t displays any error. But when I am executing the below code,the console log is not printing.
node . on ( ‘peer:discovery’ , ( peer ) => {
console.log(‘Discovered:’)
})
Can you show the versions of the packages you are using via your package.json?
Anyone please help me to resolve this issue?
From what I can see from your code it looks like you are using the libp2p-webrtc-star
transport, but you are using a libp2p-websocket-star
address.
const SIGNAL_SERVER = '/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star/ipfs/:peer-id'
is a libp2p-websocket-star
server, in order to connect to it you need to use that transport, instead of the webrtc transport.
@jacobheun Can you suggest a stable signal server that supports libp2p-webrtc-star
transport. I tried the below signal servers but it was showing some error.
const SIGNAL_SERVER = ‘/dns4/star-signal.cloud.ipfs.team/tcp/443/wss/p2p-webrtc-star/ipfs/:peer-id’
const SIGNAL_SERVER = ‘/dns4/wrtc-star.discovery.libp2p.io/tcp/443/wss/p2p-webrtc-star/ipfs/:peer-id’
Error:
Firefox can’t establish a connection to the server at wss://star-signal.cloud.ipfs.team/socket.io/?EIO=3&transport=websocket.
We’re working on rolling out new servers for webrtc star and will post when that’s been completed. In the interim I would recommend running a signaling server for development, https://github.com/libp2p/js-libp2p-webrtc-star#rendezvous-server-aka-signalling-server.