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

Seeding from node fails #294

Closed
cjb opened this issue Apr 2, 2015 · 8 comments
Closed

Seeding from node fails #294

cjb opened this issue Apr 2, 2015 · 8 comments

Comments

@cjb
Copy link

@cjb cjb commented Apr 2, 2015

Seeding a file from node is failing here:

var WebTorrent = require('webtorrent')
var client = new WebTorrent()
client.seed('myfile', function onTorrent (torrent) {
  console.log('Torrent info hash:', torrent.infoHash)
})

results in:

ReferenceError: WebSocket is not defined
    at Socket._init (/home/cjb/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/simple-websocket/index.js:44:18)
    at new Socket (/home/cjb/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/simple-websocket/index.js:22:8)
    at new WebSocketTracker (/home/cjb/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/lib/websocket-tracker.js:36:49)
    at /home/cjb/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/client.js:66:16
    at Array.map (native)
    at new Client (/home/cjb/node_modules/webtorrent/node_modules/torrent-discovery/node_modules/bittorrent-tracker/client.js:55:6)
    at Discovery._createTracker (/home/cjb/node_modules/webtorrent/node_modules/torrent-discovery/index.js:97:18)
    at Discovery.setTorrent (/home/cjb/node_modules/webtorrent/node_modules/torrent-discovery/index.js:58:10)
    at Torrent._onSwarmListening (/home/cjb/node_modules/webtorrent/lib/torrent.js:210:18)
    at Swarm.g (events.js:180:16)

(It's trying to use wss://tracker.webtorrent.io/)

Is it user error, or a bug?

@zajac

This comment has been minimized.

Copy link

@zajac zajac commented Apr 4, 2015

+1. I see exactly the same problem.

@cjb

This comment has been minimized.

Copy link
Author

@cjb cjb commented Apr 4, 2015

@zajac new WebTorrent({tracker: false}) works, by the way, though that doesn't help if you wanted to use a tracker.

@pldubouilh

This comment has been minimized.

Copy link
Contributor

@pldubouilh pldubouilh commented Apr 5, 2015

Same here, can't use new WebTorrent() without {tracker: false}

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 6, 2015

Thanks for reporting. I'm preparing webtorrent to support connecting to browser peers with WebRTC, and I npm publish'd a few of the dependencies a bit early, namely bittorrent-tracker. I'll fix this up today!

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 6, 2015

Okay, the reported crash should be fixed now. You can get the latest webtorrent dependencies by simply reinstalling:

npm rm webtorrent && npm i webtorrent

Or by updating all dependencies:

npm update

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Apr 6, 2015

So, the reported issue is fixed, but webtorrent will still crash if web peers are actually found from the webtorrent tracker. Admittedly, this is super rare, so you probably have nothing to worry about :)

There will be a complete fix once the hybrid client is done. It's really close. Last thing I need to do is merge webtorrent-swarm into bittorrent-swarm so webtorrent can just treat both types of peers the same and the complexity is handled in bittorrent-swarm. This is the last piece.

That's how bittorrent-tracker and torrent-discovery currently do it, and it's worked well so far :)

@cjb

This comment has been minimized.

Copy link
Author

@cjb cjb commented Apr 6, 2015

I saw this error the first time I tried seeding with webtorrent after updating version, haven't seen it again:

 λ node webtorrent.js
idHex a984c28c475372e3589ac8dc8bdd07a226c17cce

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: write Unknown system errno 89
    at errnoException (net.js:901:11)
    at Object.afterWrite (net.js:718:19)
@cjb

This comment has been minimized.

Copy link
Author

@cjb cjb commented Apr 7, 2015

I haven't seen this again and I think I might have hit ctrl-c, so I'm gonna go ahead and close this issue. I successfully seeded and downloaded using node with the new npm version. Thanks!

@cjb cjb closed this Apr 7, 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
4 participants
You can’t perform that action at this time.