Javascript &引用;错误:写入EPIPE“;在node.js上使用Socket.io

Javascript &引用;错误:写入EPIPE“;在node.js上使用Socket.io,javascript,node.js,socket.io,serverside-javascript,Javascript,Node.js,Socket.io,Serverside Javascript,我手动应用了此修补程序,现在一切正常。正在等待上游解决此问题 我只是试着按照给出的例子来做,并试图让它发挥作用 Mockserver.js: var io = require('socket.io').listen(8000); io.sockets.on('connection', function(client) { console.log('+ new client'); client.on('disconnect', function() { con

我手动应用了此修补程序,现在一切正常。正在等待上游解决此问题


我只是试着按照给出的例子来做,并试图让它发挥作用

Mockserver.js:

var io = require('socket.io').listen(8000);

io.sockets.on('connection', function(client) {
    console.log('+ new client');
    client.on('disconnect', function() {
        console.log('- lost a client');
    });
});
Mockclient.js:

var io = require('socket.io-client');
var socket = new io.connect('localhost', { port: 8000 });

socket.on('connect', function() {
    console.log('connected');
});

socket.on('message', function(data) {
    console.log(data);
});
然后,我在另一个终端上使用node Mockserver.js和node Mockclient.js运行这对

   info  - socket.io started
   debug - client authorized
   info  - handshake authorized 14797776461130411158
   debug - setting request GET /socket.io/1/websocket/14797776461130411158
   debug - set heartbeat interval for client 14797776461130411158
   debug - client authorized for 
   debug - websocket writing 1::
+ new client
   debug - set close timeout for client 14797776461130411158
   ***************************** error occurs here ****************
   info  - socket error Error: write EPIPE
   at errnoException (net.js:632:11)
   at Object.afterWrite [as oncomplete] (net.js:470:18)
   ****************************************************************
   debug - setting request GET /socket.io/1/xhr-polling/14797776461130411158?t=1325912082073
   debug - setting poll timeout
   debug - discarding transport
   debug - cleared close timeout for client 14797776461130411158
   debug - cleared heartbeat interval for client 14797776461130411158
   debug - clearing poll timeout
   info  - transport end
   debug- set close timeout for client 14797776461130411158
   debug - cleared close timeout for client 14797776461130411158
此时,我停止了Mockclient.js

- lost a client
   debug - discarding transport
“node Mockclient.js”的唯一输出是

是什么导致套接字异常?我可能错过了一些很明显的东西。另外,其他人可以试试我的代码,看看他们的机器上是否也有错误?socket.on('connect')中的代码也没有触发。我不知道确切原因。

应用此修补程序

修补后,我遇到以下错误:module.js:332抛出新错误(“找不到模块”+“请求+”);^error:找不到模块“ws”有什么想法吗?@MartinKapfhammer您可能想执行
npm安装-g ws
The "sys" module is now called "util". It should have a similar interface.