Skip to content

Commit

Permalink
Fixed long polling for IE8
Browse files Browse the repository at this point in the history
 - Added timestamp to make sure GET requests are not cached
 - Make sure timestamp is not confounded with the protocol sessionId
  • Loading branch information
rauchg committed May 27, 2010
1 parent 8a34dc7 commit 0cc19a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ io.Transport = ioClass({
+ ':' + this.base.options.port
+ '/' + this.base.options.resource
+ '/' + this.type
+ (this.sessionid ? ('/' + this.sessionid) : '');
+ (this.sessionid ? ('/' + this.sessionid) : '/');
}

});
12 changes: 8 additions & 4 deletions lib/transports/xhr-polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@

connect: function(){
var self = this;
this._xhr = this._request('', 'GET');
this._xhr = this._request(+ new Date, 'GET');
this._xhr.onreadystatechange = function(){
if (self._xhr.status == 200 && self._xhr.readyState == 4){
if (self._xhr.responseText.length) self._onData(self._xhr.responseText);
var status;
if (self._xhr.readyState == 4){
self._xhr.onreadystatechange = empty;
self.connect();
try { status = self._xhr.status; } catch(e){}
if (status == 200){
if (self._xhr.responseText.length) self._onData(self._xhr.responseText);
self.connect();
}
}
};
this._xhr.send();
Expand Down

0 comments on commit 0cc19a5

Please sign in to comment.