Add a key field to messages and allow lookup of most recent message by key.

This commit is contained in:
Ian Gulliver
2014-05-11 15:43:45 +03:00
parent b7bd396c9b
commit 0575b8918d
4 changed files with 85 additions and 43 deletions

View File

@@ -88,11 +88,15 @@ cosmopolite.Client.prototype.unsubscribe = function(subject) {
});
};
cosmopolite.Client.prototype.sendMessage = function(subject, message) {
this.sendRPC_('sendMessage', {
cosmopolite.Client.prototype.sendMessage = function(subject, message, key) {
args = {
'subject': subject,
'message': message,
});
};
if (key) {
args['key'] = key;
}
this.sendRPC_('sendMessage', args);
};
cosmopolite.Client.prototype.getMessages = function(subject) {