Skip to content

Multiple client connections to same server causes crash #887

@timofverberg

Description

@timofverberg

When connecting more than one socket, I get an instant crash.
Minimal code:

var WebSocket = require('ws');
var socket1 = new WebSocket('ws://localhost:5555')
var socket2 = new WebSocket('ws://localhost:5555')

Error:

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

Error: socket hang up
    at createHangUpError (_http_client.js:254:15)
    at Socket.socketOnEnd (_http_client.js:346:23)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

The server used is a custom ws server, not the one included.
Does this have anything to do with #684 ?
@LordMajestros noted that "existing connections are reused when connecting to the same server".
And the solution is to "force new connection"
But I can't find any reference to this in the code or docs...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions