mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 18:42:15 +00:00
chore: update getting started connect event (#752)
This commit is contained in:
parent
58b793d700
commit
0087218194
@ -232,8 +232,8 @@ node.on('peer:discovery', (peer) => {
|
|||||||
console.log('Discovered %s', peer.id.toB58String()) // Log discovered peer
|
console.log('Discovered %s', peer.id.toB58String()) // Log discovered peer
|
||||||
})
|
})
|
||||||
|
|
||||||
node.on('peer:connect', (peer) => {
|
node.connectionManager.on('peer:connect', (connection) => {
|
||||||
console.log('Connected to %s', peer.id.toB58String()) // Log connected peer
|
console.log('Connected to %s', connection.remotePeer.toB58String()) // Log connected peer
|
||||||
})
|
})
|
||||||
|
|
||||||
// start libp2p
|
// start libp2p
|
||||||
|
@ -5,7 +5,7 @@ import WebRTCStar from 'libp2p-webrtc-star'
|
|||||||
import { NOISE } from 'libp2p-noise'
|
import { NOISE } from 'libp2p-noise'
|
||||||
import Secio from 'libp2p-secio'
|
import Secio from 'libp2p-secio'
|
||||||
import Mplex from 'libp2p-mplex'
|
import Mplex from 'libp2p-mplex'
|
||||||
import Boostrap from 'libp2p-bootstrap'
|
import Bootstrap from 'libp2p-bootstrap'
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
// Create our libp2p node
|
// Create our libp2p node
|
||||||
@ -23,11 +23,13 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||||||
transport: [Websockets, WebRTCStar],
|
transport: [Websockets, WebRTCStar],
|
||||||
connEncryption: [NOISE, Secio],
|
connEncryption: [NOISE, Secio],
|
||||||
streamMuxer: [Mplex],
|
streamMuxer: [Mplex],
|
||||||
peerDiscovery: [Boostrap]
|
peerDiscovery: [Bootstrap]
|
||||||
},
|
},
|
||||||
config: {
|
config: {
|
||||||
peerDiscovery: {
|
peerDiscovery: {
|
||||||
bootstrap: {
|
// The `tag` property will be searched when creating the instance of your Peer Discovery service.
|
||||||
|
// The associated object, will be passed to the service when it is instantiated.
|
||||||
|
[Bootstrap.tag]: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
list: [
|
list: [
|
||||||
'/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
|
'/dns4/ams-1.bootstrap.libp2p.io/tcp/443/wss/p2p/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user