Commit 313b1ea 1 parent 01aa447 commit 313b1ea Copy full SHA for 313b1ea
File tree 3 files changed +24
-4
lines changed
3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -313,13 +313,25 @@ unless they are performing a specific action. See [peer discovery and auto dial]
313
313
314
314
##### ` libp2p.on('peer:connect', (peer) => {}) `
315
315
316
- > We connected to a new peer
316
+ > We have a new muxed connection to a peer
317
317
318
318
- ` peer ` : instance of [ PeerInfo] [ ]
319
319
320
320
##### ` libp2p.on('peer:disconnect', (peer) => {}) `
321
321
322
- > We disconnected from Peer
322
+ > We have closed a connection to a peer
323
+
324
+ - ` peer ` : instance of [ PeerInfo] [ ]
325
+
326
+ ##### ` libp2p.on('connection:start', (peer) => {}) `
327
+
328
+ > We created a new connection to a peer
329
+
330
+ - ` peer ` : instance of [ PeerInfo] [ ]
331
+
332
+ ##### ` libp2p.on('connection:end', (peer) => {}) `
333
+
334
+ > We closed a connection to a peer
323
335
324
336
- ` peer ` : instance of [ PeerInfo] [ ]
325
337
Original file line number Diff line number Diff line change 42
42
"debug" : " ^4.1.1" ,
43
43
"err-code" : " ^1.1.2" ,
44
44
"fsm-event" : " ^2.1.0" ,
45
- "libp2p-connection-manager" : " ~0.0.2 " ,
45
+ "libp2p-connection-manager" : " ~0.1.0 " ,
46
46
"libp2p-floodsub" : " ~0.15.8" ,
47
47
"libp2p-ping" : " ~0.8.5" ,
48
- "libp2p-switch" : " ~0.42.8 " ,
48
+ "libp2p-switch" : " ~0.42.9 " ,
49
49
"libp2p-websockets" : " ~0.12.2" ,
50
50
"mafmt" : " ^6.0.7" ,
51
51
"multiaddr" : " ^6.0.6" ,
Original file line number Diff line number Diff line change @@ -85,6 +85,14 @@ class Node extends EventEmitter {
85
85
} )
86
86
}
87
87
88
+ // Events for anytime connections are created/removed
89
+ this . _switch . on ( 'connection:start' , ( peerInfo ) => {
90
+ this . emit ( 'connection:start' , peerInfo )
91
+ } )
92
+ this . _switch . on ( 'connection:end' , ( peerInfo ) => {
93
+ this . emit ( 'connection:end' , peerInfo )
94
+ } )
95
+
88
96
// Attach crypto channels
89
97
if ( this . _modules . connEncryption ) {
90
98
let cryptos = this . _modules . connEncryption
You can’t perform that action at this time.
0 commit comments