Move message handling in RPC responses out of individual commands and to a general property of the response.

This commit is contained in:
Ian Gulliver
2014-05-06 13:47:57 -07:00
parent cf05c0f620
commit bb5c0752b1
3 changed files with 17 additions and 10 deletions

View File

@@ -136,6 +136,9 @@ cosmopolite.Client.prototype.sendRPCs_ = function(commands, delay) {
this.$.proxy(commands[i]['onSuccess'], this)(data.responses[i]);
}
}
// Handle messages that were immediately available as if they came over the
// channel.
data['messages'].forEach(this.onServerMessage_, this);
})
.fail(function(xhr) {
var intDelay =
@@ -181,9 +184,6 @@ cosmopolite.Client.prototype.onCreateChannel_ = function(data) {
onmessage: this.$.proxy(this.onSocketMessage_, this),
onerror: this.$.proxy(this.onSocketError_, this),
});
// Handle messages that were immediately available as if they came over the
// channel.
data['messages'].forEach(this.onServerMessage_, this);
};
cosmopolite.Client.prototype.onSocketOpen_ = function() {