HenningM / express-ws

WebSocket endpoints for express applications
BSD 2-Clause "Simplified" License
878 stars 142 forks source link

Fix https://github.com/HenningM/express-ws/issues/64 by setting a str… #92

Closed mdvanes closed 6 years ago

mdvanes commented 6 years ago

…ing in the _header property of the response.

I also ran into this issue: https://github.com/HenningM/express-ws/issues/64 According to dougwilson https://github.com/HenningM/express-ws/issues/64#issuecomment-315092334 who seems to be an Express maintainer, the problem was this missing property.

Now, I have done this patch without a thorough understanding of your library, and without diving deeply into dougwilson's answer, but it seems to fix the problem for me.

Maybe this will help some other people, too.

salzig commented 4 years ago

just as a note, i still get this error, unless i move the dummyREsponse._header out and before the conditional.

like so:

      dummyResponse._header = '';
      if (statusCode > 200) {
        /* Something in the middleware chain signalled an error. */         /* Something in the middleware chain signalled an error. */
        socket.close();         socket.close();
      }
mdvanes commented 4 years ago

This was merged and I have been using version 4.x in production ever since and that solved my issue. @salzig Could you log the value of statusCode? Maybe you get an sub 200 code or (more likely) an undefined?