Closed olalonde closed 8 years ago
Interestingly, I added a console.log here:
exports.hexToBinary = function (str) {
console.log(str.length);
return new Buffer(str, 'hex').toString('binary')
}
and apparently, the string is just 40 characters...
Now getting a similar error here:
node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/lib/Receiver.js:386
default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break;
^
RangeError: out of range index
at RangeError (native)
at fastCopy (/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/lib/Receiver.js:386:24)
at Receiver.add (/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/lib/Receiver.js:86:3)
at TLSSocket.realHandler (/node_modules/torrent-discovery/node_modules/bittorrent-tracker/node_modules/ws/lib/WebSocket.js:800:20)
at emitOne (events.js:77:13)
at TLSSocket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at TLSSocket.Readable.push (_stream_readable.js:110:10)
at TLSWrap.onread (net.js:523:20)
Strange... Maybe this is due to the wrtc module not being compiled properly?
Well, those errors seem to go away with node 0.12.7.
Getting a similar error from an entirely different code base - but I notice the ws
and wrtc
modules are in common
@olalonde Since your issue was fixed by upgrading to a newer version of node, I am going to close this issue now.
@kumavis It would be interesting to know what version of node you're using.
got the same error on v4.2.3
and v5.3.0
Sadly, I can't figure out what the issue might be without more information. Are you using a memory-constrained device like a Raspberry Pi? What do you think might be causing this?
no, modern laptop - I don't think the actual issue matches the error message. I think wrtc
somehow replaced the native Buffer
? I'm not really sure, and I'm not familiar with how native bindings work. I've avoided this issue by running in headless electron and using their wrtc classes. This is not a problem for me anymore, so I'm not going to pursue it. but thank you for following up.
Okay, thanks for letting me know. I think we're going to move away from wrtc
in webtorrent-hybrid
so hopefully this won't be an issue for anyone else in the future.
@feross curious what you plan to replace it with. I was daydreaming about a module that would summon a headless electron process, setup an rpc over a stream, and create remote versions of the wrtc classes that mirrored their behaviour in the electron runtime. but seems like a large api surface area and would be a challenge to reproduce any synchronous behaviour.
@kumavis - that's actually something I've though of before! I think it actually might be possible too :)
However, I'm currently placing my hopes in https://github.com/nickdesaulniers/node-rtc-peer-connection by @nickdesaulniers. If that works out, it'll be a pure JavaScript WebRTC implementation, and all our problems will be solved :+1:
ah, nice! the javascript singularity approaches...
Indeed!
FWIW, I got this same error in an unrelated project on Node 5.5 because I tried to send a Buffer through a node-webrtc DataChannel. I don't know how that could have caused the original error, though, because it seems like simple-peer takes care of converting from Buffers.
For anyone who searches for this error message, you might instead want to check out js-platform/node-webrtc#103, "Allow sending node.js Buffer objects."
@paulkernfeld thanks for the link. At this point, I'm really hoping someone would take over node-webrtc and do a rewrite from scratch. If only I didn't suck at C++...
There's an issue about this on the main webtorrent repo: https://github.com/feross/webtorrent/issues/820 where we've made progress toward fixing this.
Getting this error when my client tries to connect to a webrtc peer: