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

Browser VS Electron #1318

Closed
Ciao121 opened this issue Mar 1, 2018 · 4 comments
Closed

Browser VS Electron #1318

Ciao121 opened this issue Mar 1, 2018 · 4 comments

Comments

@Ciao121
Copy link

@Ciao121 Ciao121 commented Mar 1, 2018

What version of WebTorrent?
0.98.23
What operating system and Node.js version?
Windows 10 / Node 8.5.0 / electron 1.7.9
What browser and version? (if using WebTorrent in the browser)
Chrome / Firefox

Hi,
I'm developing an electron app and I have a problem with time needed to start a download.
I tried e.g. the infohash 6a9759bffd5c0af65319979fb7832189f4f3c35d (a sintel infohash).

On instant.io and using magnet player in the browser it starts in few seconds.
In the electron app it waits a lot (also minutes) before starting download.

Obviously I'm trying on the same PC, same connection etc.
Any idea?

Thank you!

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Mar 1, 2018

Depending on which process (render or main) of Electron you run WebTorrent in you might be connecting to WebRTC clients or TCP/UDP clients.

I think this might be it.

@Ciao121

This comment has been minimized.

Copy link
Author

@Ciao121 Ciao121 commented Mar 1, 2018

I'm going to look into it. But it happens also with files I'm the only seeder (seeding using WebRTC).
Update: WebTorrent.WEBRTC_SUPPORT gives me true.

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Mar 2, 2018

https://instant.io automatically adds tracker servers (which helps with finding peers super quickly).

Without any trackers, the only way to find peers is the DHT, which can sometimes take a while.

If you're using client.add() with an info hash (which you said you're doing) then you need to pass the announce option to force add tracker servers.

Or, a better way to do this is:

global.WEBTORRENT_ANNOUNCE = createTorrent.announceList
  .map(function (arr) {
    return arr[0]
  })
  .filter(function (url) {
    return url.indexOf('wss://') === 0 || url.indexOf('ws://') === 0
  })

From instant.io source code: https://github.com/webtorrent/instant.io/blob/b898193ba36f6f1b748cf23c444d3491c2d3fa78/client/index.js#L15-L21

@feross feross closed this Mar 2, 2018
@Ciao121

This comment has been minimized.

Copy link
Author

@Ciao121 Ciao121 commented Mar 3, 2018

I was alread adding a tracker programmatically (did not specify this in my post) in this way:
client.add(dataFolder+parsed.infoHash+'.torrent',{ announce: ['wss://mytracker.com'], path: myFolder })

I made another test. I simply opened instant.io in electron and used the same hash.
It tooks 44 seconds to start downloading (while using chrome it only took 3 seconds).

@lock lock bot locked as resolved and limited conversation to collaborators Jun 1, 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.