fix: connection emits (#352)

* fix: add connection tracking events

* chore: update dependencies
This commit is contained in:
Jacob Heun
2019-04-11 13:49:31 +02:00
committed by GitHub
parent 01aa44724e
commit 313b1eae20
3 changed files with 24 additions and 4 deletions

View File

@ -85,6 +85,14 @@ class Node extends EventEmitter {
})
}
// Events for anytime connections are created/removed
this._switch.on('connection:start', (peerInfo) => {
this.emit('connection:start', peerInfo)
})
this._switch.on('connection:end', (peerInfo) => {
this.emit('connection:end', peerInfo)
})
// Attach crypto channels
if (this._modules.connEncryption) {
let cryptos = this._modules.connEncryption