Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

"Error: write EPIPE" with Socket.io on node.js

"Error: write EPIPE" with Socket.io on node.js

Problem

I manually applied this patch and everything works now. Waiting on upstream to fix this https://github.com/LearnBoost/socket.io-client/pull/361/files


I'm just trying to follow the examples given and trying to get this to work.

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);
});

I then run these pair with node Mockserver.js and node Mockclient.js on another terminal

   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

at this point I stopped Mockclient.js

- lost a client
   debug - discarding transport

The only output for "node Mockclient.js" is

The "sys" module is now called "util". It should have a similar interface.

What's causing the socket exception? I'm probably missing something pretty obvious. Also, can somebody else try my code to see if the errors on their machine as well? The code inside socket.on('connect'... isn't triggering either. I don't exactly know why.

Problem courtesy of: Herp Derpington

Solution

Apply this patch https://github.com/LearnBoost/socket.io-client/pull/361/files

Solution courtesy of: Herp Derpington

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

"Error: write EPIPE" with Socket.io on node.js

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×