Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign uponWire called with undefined address when the peer is a web seed #1094
Comments
This comment has been minimized.
This comment has been minimized.
|
Web peer > URL? Do you mean webseed? A WebRTC Peer doesn't have a url. |
This comment has been minimized.
This comment has been minimized.
Yes ! sorry, I have updated my message. |
This comment has been minimized.
This comment has been minimized.
|
Eventually we may refactor the web seed implementation so that they don't use the same wire interface as normal peers. If that happens then there would be no However, in the meantime, you can detect the type of wire by checking the So, you can either check this property inside your bittorrent extension, or you can just skip calling Cheers! |
This comment has been minimized.
This comment has been minimized.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.

I use the event onWire (for a bittorrent extension) and I found out that the 'addr' parameter is 'undefined' when the peer connected is a webseed.
I have also seen in the code : "Sometimes RTCPeerConnection.getStats() doesn't return an ip:port for peers" which means that in that case 'addr' is also 'undefined'.
I guess bittorrent extensions are not made for webseed. But how should we know which is which? (in my case I just "wire.use" in all cases)
Moreover, if we want to know which url the webseed is, we can't.
I think webtorrent should provide the web seed's url in 'addr' field but it may break other extensions code (which may not expect an url but ip:port)
We can check afterward if 'addr' is an url or ip:port to determine if it's a web seed or not.
If you think it's safe or if you have a better way to fix this, I can make a PR.
Tested with webtorrent 0.98.15 but it was also the case with older versions.
npm 4.4.4 on linux (debian) on Firefox 52b