Network Error 12152: WebSockets in Edge and IE 11

12,020

Looking at the Microsoft KB article you are not givng back the expected response/headers on connection setup

From the microsoft knowledge base

12152 ERROR_HTTP_INVALID_SERVER_RESPONSE

The server response could not be parsed.

From the developper docs of mozilla if you look at the Server Handshake Response part

When it gets this request, the server should send a pretty odd-looking (but still HTTP) response that looks like this (remember each header ends with \r\n and put an extra \r\n after the last one):

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=

So, I suggest you check your headers and see which responses you are sending on the handshake, so you keep in line with protocols.

Share:
12,020
SammyG
Author by

SammyG

Updated on June 04, 2022

Comments

  • SammyG
    SammyG almost 2 years

    I have a site using websockets secure (WSS) and works very well in chrome.

    Testing in IE and Edge also works however in the browser console I get Network Error 12152 which will also trigger the websocket.addEventListener("error",function(){}) if implemented.

    Everything actually works I just get this error which doesnt seem to break anything.

    Error is triggered When socket is closed from Browser Side

    Headers in EDGE enter image description here

    More Info: Example of the code I use

    //connect via wss then
    ws.addEventListener("error",function(event){ // this hits when Socket is closed})
    ws.addEventListener("open",function(){
           ws.addEventListener("message",function(event){
            //do stuff
            ws.Close()
           })
    })
    

    To Confirm the problem further

    I went to https://www.websocket.org/echo.html in edge the site which has the ability to test websocket connections. I made it connect to my server. which opens the connection without a problem. However in just the same way I have been getting problems with my code. This site also throws an error when I click the disconnect button. See Image Below. Is this a bug in IE/Edge? enter image description here

    My Server isnt disconnecting correctly? I use the above site with the default destination (Their websocket server) and not mine. There are no errors. But when connecting to mine on disconnect there are errors.

    What could be the problem?

    Thanks

  • SammyG
    SammyG over 8 years
    Headers look fine for me. And my websocket Server in C# would terminate the connection if not correct. Ill add screen shots of the headers to the question
  • Tschallacka
    Tschallacka over 8 years
    Yea, the headers look fine, what does the exception message state and tracelog? At which point does it exactly trigger? on handshake, after handshake? on receiving handshake? On pushing first data? What is the code you use to set up the connection?
  • SammyG
    SammyG over 8 years
    Looking at the timing at which the error is triggered. it is when the connection is Closed from the browser side. How would I bring up a tracelog? I will also put in example code of how I do my operations.
  • SammyG
    SammyG over 8 years
    Just found i get the same error from another site. see question.
  • Tschallacka
    Tschallacka over 8 years
    It might need an reason code for edge/ie stackoverflow.com/questions/18803971/… how to get the error. Try to analyse the event object by doing console.log(event); and viewing the properties and output in console. Do you happen to use this libary? github.com/websockets/ws/tree/master/examples