einaros/ws — Issue #38: Socket is not terminated on close with broken clients
Author: nicokaiser
Created: 2012-03-06 09:58:55+00:00
State: open

The general behavior with broken WebSocket clients is not perfect yet.

In WebSocket.prototype.terminate, you call "socket.end()", however this should be "socket.destroy()"?

In this example I use "websocket-client" (which generates a strange "Client error: payload must start with 0x00 byte" error after close by the way), and this leads to socket.end not closing the socket.

```javascript
var WebSocket = require('websocket-client').WebSocket;

var ws = new WebSocket('ws://localhost:3000/');
ws.on('open', function() {
ws.send('Hello World');
setTimeout(function() {
ws.close();
}, 1000);
});

```

If you add "setTimeout(function() {}, 10000);" after "ws.close()" you can see the connection stays open forever (until the client script terminates).