WebSocket-Node icon indicating copy to clipboard operation
WebSocket-Node copied to clipboard

Using Unix Socket

Open axot opened this issue 9 years ago • 1 comments

We use Nginx as a reverse proxy to websocket.

nginx.conf

proxy_pass http://unix:/path/to/file.sock:/;

nodejs code

var httpServer = http.createServer( httpHandler );

fs = require('fs');
sock="/path/to/file.sock";
fs.unlink(sock);
httpServer.listen( sock ,function() {});

var ws = new WebSocket({
       httpServer: httpServer,
       autoAcceptConnections:true
});

ws.on('connect', websocketConnectHandler);

This basically works fine, but sometime write EPIPE will occurs and this causes server stop.

events.js:154
    throw er; // Unhandled 'error' event
    ^

Error: write EPIPE
    at exports._errnoException (util.js:856:11)
    at WriteWrap.afterWrite (net.js:767:14)

axot avatar Sep 08 '16 03:09 axot

Yes, it is important also for server across server environment. I also not follow how to join client to UNIX-socket. It might be great option. I will try now to do that.

sseidametov avatar Jul 24 '18 13:07 sseidametov