ws 0.7.2's implementation emulates The WebSocket API by W3C but its behavior on connection fail is little different. Typically, browsers fire error event and then close event but ws module fires error event only.
Whatever the reason, it's right that transport should fire close event if it couldn't establish a connection. FYI, the above issue is reported to websockets/ws#505
ws 0.7.2's implementation emulates The WebSocket API by W3C but its behavior on connection fail is little different. Typically, browsers fire
errorevent and thencloseevent but ws module fireserrorevent only.Whatever the reason, it's right that transport should fire
closeevent if it couldn't establish a connection. FYI, the above issue is reported to websockets/ws#505