Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STUN or TURN servers #283

Closed
charlsagente opened this issue Mar 18, 2015 · 1 comment
Closed

STUN or TURN servers #283

charlsagente opened this issue Mar 18, 2015 · 1 comment

Comments

@charlsagente
Copy link

@charlsagente charlsagente commented Mar 18, 2015

Is there a certain list of STUN or TURN servers do you use in your implementation? im using wireshark and i can see in some cases there is a TURN connections to some ips addresses for https://instant.io/. Are these servers for free? are yours? is possible to have my own list of servers and tell the webtorrent API to connect to it?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Mar 18, 2015

In the browser, WebTorrent uses simple-peer to create webrtc connections. WebTorrent just uses the default ICE server settings which use the free Google STUN server and no TURN servers. You can see the code here.

So, by default, WebTorrent won't use TURN (relay servers) since they can be expensive and aren't freely run by anyone. STUN, on the other hand, is required to establish webrtc connections.

You can specify your own STUN/TURN servers like this:

var rtcConfig = {
  iceServers: [
    {"url":"stun:xx.xx.xx.xx"},
    {"url":"turn:xx.xx.xx.xx","username":"beep","credential":"boop"}
  ]
}
new WebTorrent({ rtcConfig: rtcConfig })

And, indeed, this is what https://instant.io is doing, since it uses a TURN relay server to increase reliability. This makes sense for a use-case like 1-to-1 or few-to-few file sharing, where any two peers MUST be able to connect. But for the general WebTorrent case, it doesn't make sense to use TURN since if you can't connect to some peers, it isn't the end of the world – you can always just connect to others.

@feross feross closed this Mar 18, 2015
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.