Changeset 13143
- Timestamp:
- 03/19/08 05:24:10 (8 months ago)
- Files:
-
- 1 modified
-
dojox/trunk/cometd/_base.js (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dojox/trunk/cometd/_base.js
r13107 r13143 19 19 20 20 // cometd states: 21 this.DISCONNECTED="DISCONNECTED"; // _initialized==false && _connected==false 22 this.CONNECTING="CONNECTING"; // _initialized==true && _connected==false (handshake sent) 23 this.CONNECTED="CONNECTED"; // _initialized==true && _connected==true (first successful connect) 24 this.DISCONNECTING="DISCONNECING"; // _initialized==false && _connected==true (disconnect sent) 21 22 // alex; OMG, these "constants" need to die. Java truly is a degenerative disease. 23 this.DISCONNECTED = "DISCONNECTED"; // _initialized==false && _connected==false 24 this.CONNECTING = "CONNECTING"; // _initialized==true && _connected==false (handshake sent) 25 this.CONNECTED = "CONNECTED"; // _initialized==true && _connected==true (first successful connect) 26 this.DISCONNECTING = "DISCONNECING"; // _initialized==false && _connected==true (disconnect sent) 25 27 26 28 this._initialized = false; … … 30 32 this.connectionTypes = new dojo.AdapterRegistry(true); 31 33 32 this.version ="1.0";33 this.minimumVersion ="0.9";34 this.clientId =null;35 this.messageId =0;36 this.batch =0;34 this.version = "1.0"; 35 this.minimumVersion = "0.9"; 36 this.clientId = null; 37 this.messageId = 0; 38 this.batch = 0; 37 39 38 40 this._isXD = false; 39 this.handshakeReturn =null;40 this.currentTransport =null;41 this.handshakeReturn = null; 42 this.currentTransport = null; 41 43 this.url = null; 42 this.lastMessage =null;43 this._messageQ =[];44 this.handleAs ="json-comment-optional";45 this._advice ={};46 this._backoffInterval =0;47 this._backoffIncrement =1000;48 this._backoffMax =60000;49 this._deferredSubscribes ={};50 this._deferredUnsubscribes ={};51 this._subscriptions =[];52 this._extendInList =[]; // List of functions invoked before delivering messages53 this._extendOutList =[]; // List of functions invoked before sending messages44 this.lastMessage = null; 45 this._messageQ = []; 46 this.handleAs = "json-comment-optional"; 47 this._advice = {}; 48 this._backoffInterval = 0; 49 this._backoffIncrement = 1000; 50 this._backoffMax = 60000; 51 this._deferredSubscribes = {}; 52 this._deferredUnsubscribes = {}; 53 this._subscriptions = []; 54 this._extendInList = []; // List of functions invoked before delivering messages 55 this._extendOutList = []; // List of functions invoked before sending messages 54 56 55 57 this.state = function() { 56 return this._initialized?(this._connected?this.CONNECTED:this.CONNECTING):(this._connected?this.DISCONNECTING:this.DISCONNECTED); 58 return this._initialized ? 59 (this._connected ? "CONNECTED" : "CONNECTING") : 60 ( this._connected ? "DISCONNECTING" : "DISCONNECTED"); 57 61 } 58 62 … … 168 172 r = dojo.xhrPost(bindArgs); 169 173 } 170 dojo.publish("/cometd/meta", [{cometd:this,action:"handshake",successful:true,state:this.state()}]); 174 dojo.publish("/cometd/meta", [ 175 { 176 cometd: this, 177 action: "handshake", 178 successful: true, 179 state: this.state() 180 } 181 ]); 171 182 return r; 172 183 } … … 241 252 funcName: funcName 242 253 }); 243 this._subscriptions[tname] =subs; 244 } 245 return this._deferredSubscribes[channel]; 254 this._subscriptions[tname] = subs; 255 } 256 var ret = this._deferredSubscribes[channel]||{}; 257 ret.args = dojo._toArray(arguments); 258 return ret; 246 259 } 247 260 … … 263 276 // the second half of the objOrFunc/funcName pair for identifying 264 277 // a callback function to notifiy upon channel message delivery 278 279 if( 280 (arguments.length == 1) && 281 (!dojo.isString(channel)) && 282 (channel.args) 283 ){ 284 // it's a subscription handle, unroll 285 return this.unsubscribe.apply(this, channel.args); 286 } 265 287 266 288 var tname = "/cometd"+channel;