so far I have found three solutions, none of which will work.
do you have any other simple solutions?
- can be introduced to let IE9 support WebSocket
- or simply configure it, while
does not need to change any server-side scheme
Thank you!
so far I have found three solutions, none of which will work.
do you have any other simple solutions?
does not need to change any server-side scheme
Thank you!
after testing, web-socket-js is almost compatible to the end. Because web-socket-js is based on flash, it must be required that IE8, IE9 be Flash Player 10 or later.
web-socket-js is a flash-based technology that allows browsers to use almost native WebSocket interfaces by introducing two js files and a swf file. In addition, web-socket-js still needs to do a service of flash security policy file on port 843 of ws server.
I have done WebSocket compatibility to IE5 weird mode based on stompjs and web-socket-js, myself. Of course, stompjs has compatibility problems on the lower version of IE, and stompjs is no longer maintained. You can use a version of my fork at https://github.com/wangduandu.
.mainly older versions of IE have some anomalies in regular expression behavior.
// fix ie8, ie9, RegExp not normal problem
// in chrome the frames length will be 2, but in ie8, ie9, it well be 1
// by wdd 20180321
if (frames.length === 1) {
frames.push('')
}
< H1 > example of web-socket-js usage < / H1 >
<!-- Import JavaScript Libraries. -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript" src="web_socket.js"></script>
<script type="text/javascript">
// Let the library know where WebSocketMain.swf is:
WEB_SOCKET_SWF_LOCATION = "WebSocketMain.swf";
// Write your code in the same way as for native WebSocket:
var ws = new WebSocket("ws://example.com:10081/");
ws.onopen = function() {
ws.send("Hello"); // Sends a message.
};
ws.onmessage = function(e) {
// Receives a message.
alert(e.data);
};
ws.onclose = function() {
alert("closed");
};
</script>
if your WebSocket is always disconnected, please refer to https://wdd.js.org/websocket-.
.all three solutions have passed the test. The web-socket-js I tested is not supported in IE8 mode, so it's crazy to find problems. No solution was found on github.
does sockjs support IE9?
Port 843 of the websocket server also needs to deploy a flash security policy file service;
how to deploy this? Running: make sure the server is running and flash socket policy file is currectly placed
many lower versions of browsers do not support websocket very well, so it is necessary to do downward compatibility. Generally, it is troublesome to mix websocket+polling to do this. In formal projects, you can consider the use of third-party push frameworks such as GoEasy, which are compatible, and also support wss, heartbeat and reconnection mechanisms. Address: https://www.goeasy.io/
.