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

not entering client.add() #980

Closed
c00kie17 opened this issue Nov 20, 2016 · 5 comments
Closed

not entering client.add() #980

c00kie17 opened this issue Nov 20, 2016 · 5 comments

Comments

@c00kie17
Copy link

@c00kie17 c00kie17 commented Nov 20, 2016

here is my code:

function thefuncntion(file)
       var client = new WebTorrent();
       client.add(file,function(torrent){
           //not entering
        });	
    	   client.on('torrent',function(torrent){
          //not entering
       });	
        var val = client.get(file); //val holds the value of my torrent
        client.on('error', function (err) {
           // entering
         });
}

I didnt know where else to ask this question. Is there anything I am doing wrong ?

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Nov 21, 2016

This can happen if the magnet link you pass in has no peers and even the metadata can't be fetched. You should set a timeout to detect when this happens, or just show some torrent stats like number of peers, download speed, etc. to the user.

Also, see this FAQ answer: Why does browser downloading not work? I see no peers!

It does work! But you can't just use any random magnet uri or .torrent file. The torrent must be seeded by a WebRTC-capable client, i.e. WebTorrent Desktop, Vuze, webtorrent-hybrid, Playback, instant.io, or βTorrent.

In the browser, WebTorrent can only download torrents that are explicitly seeded to web peers via a WebRTC-capable client. Desktop torrent clients need to support WebRTC to connect to web browsers.

@feross feross closed this Nov 21, 2016
@c00kie17

This comment has been minimized.

Copy link
Author

@c00kie17 c00kie17 commented Nov 21, 2016

Hi ,Thanks for the answer. I am using a .torrent or a magnet link which has more than 50 peers and seeders for my testing. It works perfectly fine if I run webtorrent on a nodejs server, but I encounter this error running it on browser javascript.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Nov 21, 2016

@c00kie17 in Node, WebTorrent connects to TCP/UDP peers. On the browser it can't, it can only connect to WebRTC peers, I suppose your torrent doesn't have any.

webtorrent-hybrid and WebTorrent Desktop can connect to both type of peers.

@c00kie17

This comment has been minimized.

Copy link
Author

@c00kie17 c00kie17 commented Nov 22, 2016

Thanks for the reply, I got what you are trying to say. My mistake should have researched more before asking a question here. Thank you.

@lock

This comment has been minimized.

Copy link

@lock 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 pull requests

Successfully merging a pull request may close this issue.

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