webtorrent / webtorrent-hybrid

WebTorrent (with WebRTC support in Node.js)
https://webtorrent.io
MIT License
518 stars 98 forks source link

Error starting `electron-webrtc` on Cent OS #40

Closed ipsBruno closed 8 years ago

ipsBruno commented 8 years ago

I run this command in node


var WebTorrent = require('webtorrent-hybrid');
var client = new WebTorrent()

files = '/home/teste.mp4';

client.seed(files, function (torrent) {
    console.log('Client is seeding:', torrent.magnetURI );
})

And show:

Client is seeding: magnet:?xt=urn:btih:011e44ce997698779c31269114337f5c958e0126&dn=teste.mp4&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&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

But in web brower this code don't show any response in console

var torrentId = 'magnet:?xt=urn:btih:011e44ce997698779c31269114337f5c958e0126&dn=teste.mp4&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&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'; 

var client = new WebTorrent()

client.add(torrentId, function (torrent) {
  console.log(torrent.files[0]); 
})

And in uTorrent works fine.

Thank you.

DiegoRBaquero commented 8 years ago

What's your setup like? Running inside a headless Linux machine with Xvfb?

ipsBruno commented 8 years ago

Is Centos 6 32 bits. Running inside Xvfb

I already try this:

var Xvfb = require('xvfb');
var xvfb = new Xvfb();
xvfb.startSync();

var WebTorrent = require('webtorrent-hybrid');
var client = new WebTorrent()

files = '/home/public_html/uploads/teste.mp4';

client.seed(files, function (torrent) {
    console.log('Client is seeding:', torrent.magnetURI );
})

But still works only in uTorrent

Thank for your reply.

ipsBruno commented 8 years ago

Have a problem with xvfb library

npm install xvfb

sleep@3.0.1 install /root/node_modules/xvfb/node_modules/sleep node-gyp rebuild Error: Cannot find module '/root/node_modules/xvfb/node_modules/sleep/sh' npm WARN optional dep failed, continuing sleep@3.0.1

So:

npm intall sleep

npm ERR! sleep@3.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1

npm ERR! Failed at the sleep@3.0.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the sleep package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild

https://github.com/Rob--W/node-xvfb https://github.com/ErikDubbelboer/node-sleep

feross commented 8 years ago

What version of Node.js are you using? Run node --version. Ensure you're running at least Node v4.

ipsBruno commented 8 years ago

Hi Feross. Thanks for your repply. My node version is v4.4.7

feross commented 8 years ago

@mappum Does electron-webrtc work on Cent OS?

ipsBruno commented 8 years ago

Feross, WebTorrent don't have any binarie (compiled) to send files to WebRTC browser?

Sorry my English. Thank you.

feross commented 8 years ago

@ipsBruno Your options are webtorrent-hybrid or WebTorrent Desktop.

ipsBruno commented 8 years ago

Feross. WebTorrent-Hybrid don't work here. WebTorrent Desktop have any command line?

feross commented 8 years ago

Sorry, WebTorrent Desktop has no command line.

ipsBruno commented 8 years ago

Okay.

I'll try to run WebTorrent-Hybrid.

Thank you very much.

ipsBruno commented 8 years ago

Yep.

Here, WebTorrent-Hybrid don't send data to WebRTC data.

mappum commented 8 years ago

@feross I recently published some improvements to electron-webrtc and its dependency electron-eval, so errors from the Electron process will be emitted on the Node side.

Does electron-webrtc work on Cent OS?

Just tried it out, I'm getting an error from Electron that I don't know how to fix: /root/.nvm/versions/node/v6.4.0/lib/node_modules/webtorrent-hybrid/node_modules/electron-prebuilt/dist/electron: error while loading shared libraries: libnode.so: cannot open shared object file: No such file or directory

mappum commented 8 years ago

@ipsBruno Can you reinstall webtorrent-hybrid and with the latest dependencies and see if you get an error like in my previous comment?

ipsBruno commented 8 years ago

I get this error:

/root/node_modules/webtorrent-hybrid/node_modules/electron-webrtc/node_modules/electron-eval/node_modules/electron-prebuilt/dist/electron: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

I'll try install libXss ...

mappum commented 8 years ago

@ipsBruno Thanks. I think libXss is just a part of Electron, so you shouldn't need to install anything. We'll just have to figure out why Electron can't load it.

ipsBruno commented 8 years ago

Mappum, thank for your reply.

I fix this with: yum install libXScrnSave

But, i get new error now. 'GLIBCXX_3.4.15' is not found My libstdc++ is outdated aparrently.

I'll try update.

Thank you.

mappum commented 8 years ago

Ah I see, I assumed libXss was Electron because my error was about libNode, which is part of Electron.

feross commented 8 years ago

Potentially related: https://github.com/atom/atom/issues/2177

feross commented 8 years ago

@mappum Is it enough to listen for errors like we're doing now:

var wrtc = require('electron-webrtc')()

wrtc.on('error', function (err, source) {
})

or do we also need:

wrtc.electronDaemon.on('error', function (err, source) {
})

It looks like the daemon errors are not re-emitted on the wrtc object. Shouldn't they be?

feross commented 8 years ago

@ipsBruno So, this is likely just an issue with missing Electron deps, right?

FWIW, I just added the list of deps I needed to install on Ubuntu to the readme. See here: https://github.com/feross/webtorrent-hybrid/commit/c1d824ea5ff7ad6684d6bb1aeec1d63ac2ac2b22

If you could send a PR adding the list of deps required for Cent OS, that would be great!

ipsBruno commented 8 years ago

@feross

Nothing here.

I installed all dependencies, update libstdc++, eletrum and still not working here.

I use it:


var Xvfb = require('xvfb');
var xvfb = new Xvfb();
xvfb.startSync();

var WebTorrent = require('webtorrent-hybrid');
var client = new WebTorrent()

files = '/home/upyhd/public_html/uploads/video/045e4bdcc58b83e74461dcc98a91eace.2.mp4';

client.seed(files, function (torrent) {
    console.log('Client is seeding:', torrent.magnetURI );
})

And show me, it


root@server [/usr/lib64]# node
>
> var Xvfb = require('xvfb');
undefined
> var xvfb = new Xvfb();
undefined
> xvfb.startSync();
ChildProcess {
  domain:
   Domain {
     domain: null,
     _events: { error: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] },
  _events: { error: { [Function: g] listener: [Function] } },
  _eventsCount: 1,
  _maxListeners: undefined,
  _closesNeeded: 3,
  _closesGot: 0,
  connected: false,
  signalCode: null,
  exitCode: null,
  killed: false,
  spawnfile: 'Xvfb',
  _handle: Process { owner: [Circular], onexit: [Function], pid: 25889 },
  spawnargs: [ 'Xvfb', ':133' ],
  pid: 25889,
  stdin:
   Socket {
     _connecting: false,
     _hadError: false,
     _handle:
      Pipe {
        bytesRead: 0,
        _externalStream: {},
        fd: 14,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _parent: null,
     _host: null,
     _readableState:
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: null,
        ended: false,
        endEmitted: false,
        reading: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: false,
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        members: [] },
     _events:
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd] },
     _eventsCount: 3,
     _maxListeners: undefined,
     _writableState:
      WritableState {
        objectMode: false,
        highWaterMark: 16384,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object] },
     writable: true,
     allowHalfOpen: false,
     destroyed: false,
     _bytesDispatched: 0,
     _sockname: null,
     _writev: null,
     _pendingData: null,
     _pendingEncoding: '',
     server: null,
     _server: null },
  stdout:
   Socket {
     _connecting: false,
     _hadError: false,
     _handle:
      Pipe {
        bytesRead: 0,
        _externalStream: {},
        fd: 16,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _parent: null,
     _host: null,
     _readableState:
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: null,
        ended: false,
        endEmitted: false,
        reading: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        members: [] },
     _events:
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        close: [Function] },
     _eventsCount: 4,
     _maxListeners: undefined,
     _writableState:
      WritableState {
        objectMode: false,
        highWaterMark: 16384,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object] },
     writable: false,
     allowHalfOpen: false,
     destroyed: false,
     _bytesDispatched: 0,
     _sockname: null,
     _writev: null,
     _pendingData: null,
     _pendingEncoding: '',
     server: null,
     _server: null },
  stderr:
   Socket {
     _connecting: false,
     _hadError: false,
     _handle:
      Pipe {
        bytesRead: 0,
        _externalStream: {},
        fd: 18,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _parent: null,
     _host: null,
     _readableState:
      ReadableState {
        objectMode: false,
        highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: false,
        endEmitted: false,
        reading: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: true,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        members: [] },
     _events:
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        close: [Function],
        data: [Function: bound ] },
     _eventsCount: 5,
     _maxListeners: undefined,
     _writableState:
      WritableState {
        objectMode: false,
        highWaterMark: 16384,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        bufferedRequest: null,
        lastBufferedRequest: null,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        bufferedRequestCount: 0,
        corkedRequestsFree: [Object] },
     writable: false,
     allowHalfOpen: false,
     destroyed: false,
     _bytesDispatched: 0,
     _sockname: null,
     _writev: null,
     _pendingData: null,
     _pendingEncoding: '',
     server: null,
     _server: null },
  stdio:
   [ Socket {
       _connecting: false,
       _hadError: false,
       _handle: [Object],
       _parent: null,
       _host: null,
       _readableState: [Object],
       readable: false,
       domain: [Object],
       _events: [Object],
       _eventsCount: 3,
       _maxListeners: undefined,
       _writableState: [Object],
       writable: true,
       allowHalfOpen: false,
       destroyed: false,
       _bytesDispatched: 0,
       _sockname: null,
       _writev: null,
       _pendingData: null,
       _pendingEncoding: '',
       server: null,
       _server: null },
     Socket {
       _connecting: false,
       _hadError: false,
       _handle: [Object],
       _parent: null,
       _host: null,
       _readableState: [Object],
       readable: true,
       domain: [Object],
       _events: [Object],
       _eventsCount: 4,
       _maxListeners: undefined,
       _writableState: [Object],
       writable: false,
       allowHalfOpen: false,
       destroyed: false,
       _bytesDispatched: 0,
       _sockname: null,
       _writev: null,
       _pendingData: null,
       _pendingEncoding: '',
       server: null,
       _server: null },
     Socket {
       _connecting: false,
       _hadError: false,
       _handle: [Object],
       _parent: null,
       _host: null,
       _readableState: [Object],
       readable: true,
       domain: [Object],
       _events: [Object],
       _eventsCount: 5,
       _maxListeners: undefined,
       _writableState: [Object],
       writable: false,
       allowHalfOpen: false,
       destroyed: false,
       _bytesDispatched: 0,
       _sockname: null,
       _writev: null,
       _pendingData: null,
       _pendingEncoding: '',
       server: null,
       _server: null } ] }
>
> var WebTorrent = require('webtorrent-hybrid');
undefined
> var client = new WebTorrent()
undefined
>
> files = '/home/upyhd/public_html/uploads/video/045e4bdcc58b83e74461dcc98a91eace.2.mp4';
'/home/upyhd/public_html/uploads/video/045e4bdcc58b83e74461dcc98a91eace.2.mp4'
>
> client.seed(files, function (torrent) {
...     console.log('Client is seeding:', torrent.magnetURI );
... })
Torrent {
  domain:
   Domain {
     domain: null,
     _events: { error: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] },
  _events:
   { _infoHash: { [Function: g] listener: [Function: onInfoHash] },
     ready: { [Function: g] listener: [Function: onReady] },
     close: { [Function: g] listener: [Function: onClose] } },
  _eventsCount: 3,
  _maxListeners: undefined,
  client:
   WebTorrent {
     domain:
      Domain {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        members: [] },
     _events: {},
     _eventsCount: 0,
     _maxListeners: undefined,
     peerId: '2d5757303039362d386331353366386136313937',
     peerIdBuffer: <Buffer 2d 57 57 30 30 39 36 2d 38 63 31 35 33 66 38 61 36 31 39 37>,
     nodeId: '2e4181d3949669894faf294e3b627d3917d02f40',
     nodeIdBuffer: <Buffer 2e 41 81 d3 94 96 69 89 4f af 29 4e 3b 62 7d 39 17 d0 2f 40>,
     destroyed: false,
     listening: false,
     torrentPort: 0,
     dhtPort: 0,
     tracker: { wrtc: [Object] },
     torrents: [ [Circular] ],
     maxConns: 55,
     _tcpPool:
      TCPPool {
        server: [Object],
        _client: [Circular],
        _pendingConns: [],
        _onConnectionBound: [Function],
        _onListening: [Function],
        _onError: [Function] },
     _downloadSpeed: [Function],
     _uploadSpeed: [Function],
     dht:
      DHT {
        _tables: [Object],
        _values: [Object],
        _peers: [Object],
        _secrets: [Object],
        _rpc: [Object],
        _verify: null,
        _host: null,
        _interval: [Object],
        listening: false,
        destroyed: false,
        nodeId: <Buffer 2e 41 81 d3 94 96 69 89 4f af 29 4e 3b 62 7d 39 17 d0 2f 40>,
        nodes: [Object],
        domain: [Object],
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: 0 } },
  _debugId: '36313937',
  announce: undefined,
  urlList: undefined,
  path: '/home/upyhd/public_html/uploads/video',
  _store: [Function: Storage],
  _getAnnounceOpts: undefined,
  strategy: 'sequential',
  maxWebConns: 4,
  _rechokeNumSlots: 10,
  _rechokeOptimisticWire: null,
  _rechokeOptimisticTime: 0,
  _rechokeIntervalId: null,
  ready: false,
  destroyed: false,
  paused: false,
  done: false,
  metadata: null,
  store: null,
  files: [],
  pieces: [],
  _amInterested: false,
  _selections: [],
  _critical: [],
  wires: [],
  _queue: [],
  _peers: {},
  _peersLength: 0,
  received: 0,
  uploaded: 0,
  _downloadSpeed: [Function],
  _uploadSpeed: [Function],
  _servers: [],
  _xsRequests: [],
  _fileModtimes: undefined }
>
>
> Client is seeding: magnet:?xt=urn:btih:37f847d09f8a54c2b3533ff44755389e84f58ec6&dn=045e4bdcc58b83e74461dcc98a91eace.2.mp4&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&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

The magnet link only works in uTorrent. In WebTorrent Browser no.

feross commented 8 years ago

@ipsBruno You don't need to start xvfb anymore. See this change to the readme: https://github.com/feross/webtorrent-hybrid/pull/41/files

Try removing that code from your node app?

ipsBruno commented 8 years ago

Hi ..

I get this error now

``

Stderr: /root/node_modules/webtorrent-hybrid/node_modules/electron-webrtc/node_modules/e lectron-eval/node_modules/electron-prebuilt/dist/electron: symbol lookup error: /root/node_modules/webtorrent-hybrid/node_modules/electron-webrtc/node_modules/e lectron-eval/node_modules/electron-prebuilt/dist/electron: undefined symbol: g_b ytes_unref

``

feross commented 8 years ago

It looks like CentOS doesn't have a pre-compiled binary for Electron. That's a bummer. See https://github.com/electron/electron/issues/259

You can try compiling Electron from scratch following the Linux compilation instructions, and then put the binary in place of the current electron-prebuilt binary.

I bet that works, but it's not gonna be fun.