I am trying to do a web socket implementaton for browser. Firefox, Chrome works great, but when i try in IE, it creates the socket object but never calls the timer.
WebSocket = function(url, protocol, proxyHost, proxyPort, headers) {
var self = this;
self.__id = WebSocket.__nextId++;
WebSocket.__instances[self.__id] = self;
self.readyState = WebSocket.CONNECTING;
self.bufferedAmount = 0;
self.__events = {};
// Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc.
// Otherwise, when onopen fires immediately, onopen is called before it is set.
setTimeout(function() {
WebSocket.__addTask(function() {
WebSocket.__flash.create(
self.__id, url, protocol, proxyHost || null, proxyPort || 0, headers || null);
});
}, 0);
};
What could be the reason?
What version of IE are you talking about? What websocket library are you using?
Web sockets are not supported by older version of IE. I think you need to use long polling instead of websockets for those older browsers...
If your using this: https://github.com/gimite/web-socket-js It's stated in the Documentation:
It should work on: Google Chrome 4 or later (just uses native implementation) Firefox 3.x, 4.x, Internet Explorer 8, 9 + Flash Player 10 or later It may or may not work on other browsers such as Safari, Opera or IE 6. Patch for these browsers are appreciated, but I will not work on fixing issues specific to these browsers by myself.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.