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

Improve docs #694

Closed
wants to merge 10 commits into from
Closed

Conversation

@FluorescentHallucinogen
Copy link
Contributor

FluorescentHallucinogen commented Mar 25, 2016

No description provided.

Change magnetURI to torrentId to avoid confusing, because client.add is not limited only to magnet URIs and there are many ways to define torrentId, e.g. HTTP(S) URL to a *.torrent file.
Use complete magnet URI to keep example working, because trackerless magnet URIs are not supported in web browser environment (at least at this moment).
Add missing port variable.
Change magnetURI to torrentId to avoid confusing, because client.add is not limited only to magnet URIs and there are many ways to define torrentId, e.g. HTTP(S) URL to a *.torrent file.
Use real magnet URI to keep example working.
Remove concrete ways of install and use modules from examples for browser environment.
Change magnetURI to torrentId to avoid confusing, because client.add is not limited only to magnet URIs and there are many ways to define torrentId, e.g. HTTP(S) URL to a *.torrent file.
Use real magnet URI to keep example working.
Remove concrete ways of install and use modules from examples for browser environment.
Fix broken link and add all available ways to specify a torrent directly to the page.
var client = new WebTorrent()
var magnetURI = '...'
var torrentId = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4'

This comment has been minimized.

Copy link
@rom1504

rom1504 Mar 25, 2016

Member

That's a magnet uri. What is a torrent id ?

This comment has been minimized.

Copy link
@FluorescentHallucinogen

FluorescentHallucinogen Mar 25, 2016

Author Contributor

@rom1504

Please look at client.add API: client.add(torrentId, [opts], [function ontorrent (torrent) {}])

Every magnet URI is torrent id. But not every torrent id is magnet URI.

torrentId can be one of:

  • magnet uri (string)
  • torrent file (buffer)
  • info hash (hex string or buffer)
  • parsed torrent (from parse-torrent)
  • http/https url to a torrent file (string)
  • filesystem path to a torrent file (string)

E.g. you can change
var magnetURI = 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d'
to
var magnetURI = 'https://webtorrent.io/torrents/sintel.torrent'
in this example and the resulting code will still work, bacause torrentId argument of client.add is not limited only to magnet URIs, but in this case using magnetURI as a name of variable is not a good idea, because actually it is not a magnet URI, it is URL to *.torrent file.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

DiegoRBaquero commented Mar 27, 2016

The variable containing the magnetURI imo should stay as magnetURI, it's one of the many torrent identifiers.

@FluorescentHallucinogen

This comment has been minimized.

Copy link
Contributor Author

FluorescentHallucinogen commented Apr 1, 2016

@DiegoRBaquero

Some new people who absolutely unfamiliar with WebTorrent might think that magnet URI is the only way to specify torrent in this example.

I've changed the name of variable magnetURI to torrentId to emphasize that users can use not only magnet URIs.

torrentId is more universal variable name than magnetURI.

@FluorescentHallucinogen

This comment has been minimized.

Copy link
Contributor Author

FluorescentHallucinogen commented Apr 1, 2016

@feross, please look at this pull request.

feross added a commit that referenced this pull request May 1, 2016
Supersedes #694
@feross

This comment has been minimized.

Copy link
Member

feross commented May 1, 2016

Thanks for the suggested doc improvements! I've merged some of your changes in this commit e3803dd but the others didn't make sense to me. Thanks again!

@feross feross closed this May 1, 2016
@lock

This comment has been minimized.

Copy link

lock bot commented May 4, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.