         wsuri = (document.location.protocol === "http:" ? "ws:" : "wss:") + "//" +
                     document.location.host + "/ws"; // URL of the Crossbar.io instance this is served from
      }

      // the WAMP connection to the Router
      //
      var connection = new autobahn.Connection({
         url: wsuri, // replace with URL of WAMP router if this doesn't serve the file
         realm: "iot_cookbook"
      });

      // fired when connection is established and session attached
      //
     