Reputation: 299
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
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?
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
Upvotes: 2
Views: 12612
Reputation: 1
I have fixed the same error in IE browsers. Check the capitalization of the first letter of websocket.
Non IE browser:
Upgrade: **w**ebsocket
IE browser:
Upgrade: **W**ebsocket
Upvotes: 0
Reputation: 28722
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.
Upvotes: 2