Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SecurityError on IE11 when initializing WebSocket

We have a code that creates multiple websocket instances every time the application is opened.

privateMembers.webSocket = new WebSocket(url, protocol);

where the url contains an authentication token. And these instances are closed when the app is closed/unload. The application is embedded (iframe) to another application when the issue is observed.

We noticed that a SecurityError exception is logged on the browser's console. And when this happens, the number of websockets being created on the next initialization is reduced. For example, we are creating 5 websocket instances, on next launch of the iframe, it will create only 4 instances and this exception is logged. We are clearing the count and the array every time we unload the application.

Also, this only happens on latest versions of IE 11 and Edge.

enter image description here

like image 712
Ray Avatar asked Dec 14 '22 14:12

Ray


1 Answers

IE 11 has a limit of 6 websocket instances per host. And it seems on the latest version of IE 11 (11.xxx), there seems to be an update on how these instances are being handled.

If we close an iframe that has websocket connections and not trigger the onclose on these instances, these instances still remains but without any reference (dangling).

And to fix our issue, we had to go through all of these websocket instances and make sure that all of them are closed when we close the iframe. The decreasing number of instances created is due to unclosed websocket instance.

We still haven't found any documentation regarding this on the latest IE 11 versions. And if anyone can provide this, it would really be great and much appreciated.

like image 137
Ray Avatar answered Dec 16 '22 04:12

Ray