diff --git a/tutorial.html b/tutorial.html index 1abb4d4..b34ff68 100644 --- a/tutorial.html +++ b/tutorial.html @@ -37,7 +37,7 @@
  1. Create an application in your SDK client
  2. -
  3. Download cosmopolite via the links at left. Unpack it into a "cosmopolite" subdirectory of your local application
  4. +
  5. Download cosmopolite via the links at left. Unpack it into your local application directory and rename the newly-created subdirectory to "cosmopolite"
  6. Create an app.yaml file for your application.
  7. Add a cosmopolite include to your app.yaml file:
    includes:
    @@ -72,10 +72,11 @@
     - url: /test.html
       static_files: test.html
       upload: test.html
  8. -
  9. Have it create a cosmopolite instance and send a message to it: +
  10. Remove the mapping for main.app from app.yaml (if using the autogenerated file)
  11. +
  12. Edit test.html. Replace "// Subsequent script examples go here" with:
    var cosmo = new Cosmopolite();
     cosmo.sendMessage('testsubject', 'test message');
  13. -
  14. Keep the debug page (from above) up and subscribed (to testsubject) in one browser tab
  15. +
  16. Keep the debug page up and subscribed (to testsubject) in one browser tab
  17. Load your test page
  18. The debug page should show the message from the test page
  19. You've written code that uses cosmopolite!
  20. @@ -95,7 +96,7 @@ cosmo.sendMessage('testsubject', 'test message');

    Subscribe to a subject

      -
    1. Change your test script: +
    2. Change test.html:
      var callbacks = {
         onMessage: function(msg) {
           alert(msg['message']);
      @@ -103,7 +104,7 @@ cosmo.sendMessage('testsubject', 'test message');
    3. }; var cosmo = new Cosmopolite(callbacks); cosmo.subscribe('testsubject'); -
    4. Load (or re-load) the test page
    5. +
    6. Load (or re-load) the test page
    7. Use the debug interface to send a message to testsubject
    8. Your test page should generate an alert popup
    @@ -113,7 +114,7 @@ cosmo.subscribe('testsubject');
    1. Cosmopolite can be used as a key/value store, with historical data and update notification
    2. When subscribing to a subject, you can request the most recent message for that subject
    3. -
    4. Change your test script: +
    5. Change test.html:
      var cosmo = new Cosmopolite();
       cosmo.subscribe('testsubject', 1).then(function() {
         var msg = cosmo.getLastMessage('testsubject');
      @@ -127,10 +128,10 @@ cosmo.subscribe('testsubject', 1).then(function() {
       
      1. Pins publish a message temporarily, until the source conncetion disconnects. This can be used for presence information
      2. Open the debug interface and subscribe to testsubject
      3. -
      4. Change your test script: +
      5. Change test.html:
        var cosmo = new Cosmopolite();
         cosmo.pin('testsubject', 'browser is alive!');
      6. -
      7. Load the test page and watch the debug page; you should see the pin.
      8. +
      9. Load the test page and watch the debug page; you should see the pin.
      10. Close the test page, and the pin disappears.