| 519 | }; |
| 520 | |
| 521 | function cleanupFailedConnection(connection) { |
| 522 | // Since we have to return a connection object even if the socket is |
| 523 | // already dead in order not to break the API, we schedule a 'close' |
| 524 | // event on the connection object to occur immediately. |
| 525 | process.nextTick(function() { |
| 526 | // WebSocketConnection.CLOSE_REASON_ABNORMAL = 1006 |
| 527 | // Third param: Skip sending the close frame to a dead socket |
| 528 | connection.drop(1006, 'TCP connection lost before handshake completed.', true); |
| 529 | }); |
| 530 | } |
| 531 | |
| 532 | module.exports = WebSocketRequest; |