 connection.onopen = function (session, details) {

         console.log("connected");

         session.call("io.crossbar.examples.yun.tilt.get_is_tilted").then(function(res) {
            console.log("tilt state currently is: ", res);
         },
         session.log);

         session.subscribe("io.crossbar.examples.yun.tilt.on_tilt", function(args) {
            console.log("Tilt state changed to: ", args[0]);
         });

      };

      // fired when connection was lost (or could not be established)