Changeset 14960 for dojox/trunk/cometd
- Timestamp:
- 08/26/08 16:44:46 (3 months ago)
- Files:
-
- 1 modified
-
dojox/trunk/cometd/RestChannels.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dojox/trunk/cometd/RestChannels.js
r14901 r14960 79 79 subscriptions: {}, 80 80 subCallbacks: {}, 81 autoReconnectTime: 3000 0,81 autoReconnectTime: 3000, 82 82 sendAsJson: false, 83 83 url: '/channels', … … 94 94 this.connectionId = dojox._clientId; 95 95 var clientIdHeader = this.started ? 'X-Client-Id' : 'X-Create-Client-Id'; 96 96 console.log("opening connection"); 97 97 var headers = {Accept:this.acceptType}; 98 98 headers[clientIdHeader] = this.connectionId; … … 101 101 this.lastIndex = 0; 102 102 var onerror, onprogress = function(data){ // get all the possible event handlers 103 console.log("xhr.status", xhr.status); 103 104 if(typeof dojo == 'undefined'){ 104 105 return null;// this can be called after dojo is unloaded, just do nothing in that case … … 109 110 var error = self.onprogress(xhr,data,contentType); 110 111 if(error){ 111 onerror(); 112 return new Error(error); 112 if(onerror()){ 113 return new Error(error); 114 } 113 115 } 114 116 if(!xhr || xhr.readyState==4){ … … 122 124 }; 123 125 onerror = function(error){ 126 if(xhr && xhr.status == 409){ 127 // a 409 indicates that there is a multiple connections, and we need to poll 128 console.log("multiple tabs/windows open, polling"); 129 self.disconnected(); 130 return null; 131 } 124 132 if(self.started){ // this means we need to reconnect 125 133 self.started = false; … … 309 317 } 310 318 try{ 311 message.data = message. content|| dojo.fromJson(message.responseText);319 message.data = message.data || dojo.fromJson(message.responseText); 312 320 } 313 321 catch(e){} … … 339 347 } 340 348 } 341 else if(dojox.io .httpParse && contentType.match(/application\/http/)){349 else if(dojox.io && dojox.io.httpParse && contentType.match(/application\/http/)){ 342 350 // do HTTP tunnel parsing 343 351 var topHeaders = '';