javascript - Network Error 12152: WebSockets in Edge and IE 11 - Stack Overflow

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

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

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 .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

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

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/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

Share Improve this question edited Oct 12, 2015 at 13:53 SammyG asked Oct 12, 2015 at 11:34 SammyGSammyG 2991 gold badge4 silver badges15 bronze badges 2
  • This is not about ajax post's @JaromandaX, the last thing you want is a closed socket connection when setting up a websocket... and a websocket is a wholly different beast from ajax. – Tschallacka Commented Oct 12, 2015 at 11:49
  • yeah, sorry about that – Jaromanda X Commented Oct 12, 2015 at 11:50
Add a ment  | 

2 Answers 2

Reset to default 2

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.

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745112047a4611905.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信