Remove RPC queueing now that we're doing client-side client_id generation.
This commit is contained in:
@@ -75,11 +75,6 @@ var Cosmopolite = function(
|
|||||||
*/
|
*/
|
||||||
this.shutdown_ = false;
|
this.shutdown_ = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {Array.<Object>}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
this.rpcQueue_ = [];
|
|
||||||
/**
|
/**
|
||||||
* @type {Object.<string, Cosmopolite.typeSubscription_>}
|
* @type {Object.<string, Cosmopolite.typeSubscription_>}
|
||||||
* @private
|
* @private
|
||||||
@@ -100,6 +95,9 @@ var Cosmopolite = function(
|
|||||||
localStorage[this.namespace_ + ':client_id'] = this.uuid_();
|
localStorage[this.namespace_ + ':client_id'] = this.uuid_();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {string} */
|
||||||
|
this.instanceID_ = this.uuid_();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
* @private
|
* @private
|
||||||
@@ -728,12 +726,7 @@ Cosmopolite.prototype.sendRPC_ = function(command, args, opt_onSuccess) {
|
|||||||
'arguments': args,
|
'arguments': args,
|
||||||
'onSuccess': opt_onSuccess || null
|
'onSuccess': opt_onSuccess || null
|
||||||
};
|
};
|
||||||
if (this.maySendRPC_()) {
|
this.sendRPCs_([rpc]);
|
||||||
this.sendRPCs_([rpc]);
|
|
||||||
} else {
|
|
||||||
// Queue instead of sending.
|
|
||||||
this.rpcQueue_.push(rpc);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -843,35 +836,14 @@ Cosmopolite.prototype.sendRPCs_ = function(commands, opt_delay) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Are we currently clear to put RPCs on the wire?
|
|
||||||
*
|
|
||||||
* @return {boolean}
|
|
||||||
* @const
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
Cosmopolite.prototype.maySendRPC_ = function() {
|
|
||||||
if (this.channelState_ != Cosmopolite.ChannelState_.OPEN) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle tasks needed after reconnecting the channel
|
* Handle tasks needed after reconnecting the channel
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Cosmopolite.prototype.onReconnect_ = function() {
|
Cosmopolite.prototype.onReconnect_ = function() {
|
||||||
if (!this.maySendRPC_()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @type {Array.<Cosmopolite.typeRPC_>} */
|
/** @type {Array.<Cosmopolite.typeRPC_>} */
|
||||||
var rpcs = this.rpcQueue_;
|
var rpcs = [];
|
||||||
this.rpcQueue_ = [];
|
|
||||||
for (var subject in this.subscriptions_) {
|
for (var subject in this.subscriptions_) {
|
||||||
/** @type {Cosmopolite.typeSubscription_} */
|
/** @type {Cosmopolite.typeSubscription_} */
|
||||||
var subscription = this.subscriptions_[subject];
|
var subscription = this.subscriptions_[subject];
|
||||||
@@ -915,9 +887,6 @@ Cosmopolite.prototype.createChannel_ = function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @type {string} */
|
|
||||||
this.instanceID_ = this.uuid_();
|
|
||||||
|
|
||||||
var rpcs = [
|
var rpcs = [
|
||||||
{
|
{
|
||||||
'command': 'createChannel',
|
'command': 'createChannel',
|
||||||
@@ -1015,6 +984,8 @@ Cosmopolite.prototype.onSocketClose_ = function() {
|
|||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.instanceID_ = this.uuid_();
|
||||||
|
|
||||||
this.createChannel_();
|
this.createChannel_();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user