-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't discover/connect new peers using webrtc-star on v0.39.5
#1442
Comments
You need to configure the peer discovery component of the WebRTCStar transport for it to work: For import { WebRTCStar } from '@libp2p/webrtc-star'
import { createLibp2p } from 'libp2p'
//... other stuff
const webRTC = new WebRTCStar({ ... })
const node = await createLibp2p( {
transports: [
webRTC
],
peerDiscovery: [
webRTC.discovery
],
//... other stuff
}) For import { webRTCStar } from '@libp2p/webrtc-star'
import { createLibp2p } from 'libp2p'
//... other stuff
const webRTC = webRTCStar({ ... })
const node = await createLibp2p( {
transports: [
webRTC.transport
],
peerDiscovery: [
webRTC.discovery
],
//... other stuff
}) The README for v5 is hopefully a bit clearer. |
@achingbrain thanks for responding. With the changes you have suggested the discovery is working (for I was wondering if this is the case now (for |
@achingbrain one more thing (side note), i start getting this influx of discovery logs and it never stops, after discovery (for any transport/peer discovery mechanism) This is the event handler code (taken from node.addEventListener('peer:discovery', (event) => {
const peerInfo = event.detail;
console.log('Discovered:', peerInfo.id.toString());
}); |
Discovered nodes are no longer dialled automatically - please see the upgrade guide - https://github.com/libp2p/js-libp2p/blob/master/doc/migrations/v0.37-v0.40.md#autodial |
@achingbrain i tested on Also, in the node configuration i have set
|
Furthur more, if i try to manually dial after discovery, i get this error [AggregateError: All promises were rejected] {
[errors]: [
AbortError: The operation was aborted
at file:///Users/ratikjindal/Zero/libp2p-webrtc-star-issue/after-esm/node_modules/@libp2p/webrtc-star/dist/src/index.js:117:26
at <anonymous> {
type: 'aborted',
code: 'ABORT_ERR'
}
]
} Update to source code: node.addEventListener('peer:discovery', async (event) => {
const peerInfo = event.detail;
console.log('Discovered:', peerInfo.id.toString());
console.log("dialing..");
try {
const ma = new Multiaddr(`/dns4/vast-escarpment-62759.herokuapp.com/tcp/443/wss/p2p-webrtc-star/p2p/${peerInfo.id.toString()}`);
await node.dial(ma);
} catch (error) {
console.log(error);
}
}); |
@achingbrain I have upgraded the As an alternative, could you please suggest what protocol to use for connection b/w two peers where one is behind a NAT? Before the esm upgrade webrtc-star servers were working fine. Anyway, can we use circuit relay (v1/v2) now?, i.e Also there is a small bug in the migration guide for |
@achingbrain -- any update on this? |
@ratik21 We likely won't pursue this issue since we are actively working to support WebRTC transport https://github.com/little-bear-labs/js-libp2p-webrtc/ and deprecate WebRTC-star (and direct) as a result. |
@p-shahi Ok, thanks for responding. few questions :-
|
@ratik21 That implementation (tracked here #1478 now) is for browser to server The browser to browser aspect is just beginning to get underway. See #1462. It's not specified yet but necessary parts like supporting Circuit Relay v2 are being added. AutoNat support is also being added, hopefully before the end of this year per our roadmap: https://github.com/libp2p/js-libp2p/blob/master/ROADMAP.md#end-of-q4-december |
@p-shahi thanks! I will try js-libp2p-webrtc for server to server, and browser to browser for new discovery and connections |
@ratik21 I'll close this issue for now. |
Peer discovery and connections are not happening with the latest libp2p version (after esm upgrade).
I have created a failing test for both versions (before & after esm), with screenshots - https://github.com/ratik21/p2p-webrtc-star-test. Please check it out. Thanks.
Related discussion thread :: https://discuss.libp2p.io/t/cant-discover-peers-with-webrtc-star-on-js-libp2p-0-37-0/1438
cc: @MarcoPolo
The text was updated successfully, but these errors were encountered: