diff --git a/tutorial.html b/tutorial.html index 117da20..ebee3b1 100644 --- a/tutorial.html +++ b/tutorial.html @@ -107,6 +107,20 @@ cosmo.subscribe('testsubject');
  • Your test page should generate an alert popup
  • +

    Using keys

    + +
      +
    1. Cosmopolite can be used as a key/value store, with historical data and update notification
    2. +
    3. Use the debug interface to send several messages to testsubject. Some of them should have the key testkey, while others should have different keys or no key.
    4. +
    5. Change your test script: +
      var cosmo = new Cosmopolite();
      +cosmo.subscribe('testsubject', 0, null, ['testkey']).then(function() {
      +  var msg = cosmo.getKeyMessage('testsubject', 'testkey');
      +  alert(msg['message']);
      +});
    6. +
    7. Your test page should generate an alert popup showing the last message sent with that key
    8. +
    +