Closed draeder closed 2 years ago
I don't understand why you need to use events for this. You can directly access the peerId
of the peer you are destroying
@draeder Please share your flow
@DiegoRBaquero Apologies, I haven't worked on the project recently that led me to believe I needed this. Please feel free to close this issue and associated PR. If it turns out I still need it when I circle back to the project, I will open a new issue/PR.
Of course! And what I meant is that you can do this:
const peerId = wire.peerId
wire.destroy()
There's no need to tap into wire's events
Perfect thanks!
What version of this package are you using? 3.4.2
What problem do you want to solve? I'm tracking peers with an extension and would like to more easily remove peers from the list of peers when their wire is closed. The problem is when the wire closes it isn't clear which peerId the close event was for. This makes removing left peers unnecessarily difficult.
What do you think is the correct solution to this problem? Emit the wire's peerId in the 'close' event when the wire closes.
Are you willing to submit a pull request to implement this change? Yes