3

我正在使用 node-v0.10.4 运行 web-sockets 代理以连接到特定类型的服务器。但是在使用 Firefox 浏览器(最新版本)通过代理建立连接后,我的终端出现以下错误。终端显示错误:

net.js:595
throw new TypeError('invalid data');
      ^
TypeError: invalid data
at Socket.write (net.js:595:11)
at WebSocket.<anonymous> (/home/n-mol/Desktop/abs-master/wsproxy/wsproxy-tcp.js:69:10)
at WebSocket.EventEmitter.emit (events.js:98:17)
at Receiver.self._receiver.onbinary (/home/n-mol/node_modules/ws/lib/WebSocket.js:549:10)
at Receiver.opcodes.2.finish (/home/n-mol/node_modules/ws/lib/Receiver.js:448:14)
at Receiver.expectHandler (/home/n-mol/node_modules/ws/lib/Receiver.js:433:33)
at Receiver.add (/home/n-mol/node_modules/ws/lib/Receiver.js:93:24)
at Socket.firstHandler (/home/n-mol/node_modules/ws/lib/WebSocket.js:524:22)
at Socket.EventEmitter.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:710:14)

以下 Javascript 代码行位于 /home/n-mol/Desktop/abs-master/wsproxy/wsproxy-tcp.js:69:10

68. if (sock_ready) {
69.        sock.write(bytesView.buffer);
70.  } else ...

我想有一些兼容性问题,但我无法解决它。任何帮助将不胜感激。提前致谢。

4

1 回答 1

3

尝试这个...

if (sock_ready) {
  sock.write(new Buffer(bytesView));
} else

看起来 Node 改变了它在 .10 和 .8 中组装缓冲区的方式我也遇到了这个问题......即将向 NDN-js 提交拉取请求;)

于 2013-07-14T15:17:11.517 回答