Add a third level construct under Profile and Client, Instance. This allows more than one connected object with the same client credentials.

This commit is contained in:
Ian Gulliver
2014-05-23 10:31:52 -07:00
parent 0d821547e3
commit 6bfa10e82a
5 changed files with 91 additions and 33 deletions

View File

@@ -45,6 +45,8 @@ var Cosmopolite = function(callbacks, urlPrefix, namespace) {
this.subscriptions_ = {};
this.profilePromises_ = [];
this.instanceId_ = this.uuid_();
this.messageQueueKey_ = this.namespace_ + ':message_queue';
if (this.messageQueueKey_ in localStorage) {
var messages = JSON.parse(localStorage[this.messageQueueKey_]);
@@ -447,6 +449,7 @@ Cosmopolite.prototype.sendRPCs_ = function(commands, delay) {
return;
}
var request = {
'instance_id': this.instanceId_,
'commands': [],
};
commands.forEach(function(command) {