How do I get one device to trigger a content change on another?

How do I get one device to trigger a content change on another?

We have several mechanisms. The experimental 'Other device - go to sign in sequence', may meet your requirements. We have had problems with devices needing to 'learn' the availability of the other device after a reboot or deploy.

An alternative is MQTT and Javascript. We will write a more comprehensive tutorial but for now here is the code...


  1. //set the URL of the WebView to this...
  2. //https://gaztesthost.s3-eu-west-1.amazonaws.com/PahoMQTTLib.html

  3. //set these variables...
  4. var g_thisSignName = "TheWalkConnectedDemo - PnL - Scratch";
  5. var g_mqttServer = "ws://mqtt.signstix.com:8080";
  6. var g_mqttTopic = "Hyper";
  7. var g_mqttPayload = '{"majorDimension":[ "1" ]}';

  8. function onSignAppeared(signName, signId)
  9. {
  10.   SignStixDebug.info("Sign appeared. signName:" + signName +" signId:" + signId);

  11.   if (signName!=g_thisSignName)
  12.   return;

  13.   var client = mqtt.connect(g_mqttServer); 

  14.   client.on('connect', function ()
  15.   {

  16.     SignStixDebug.info("Connected to " + g_mqttServer);

  17.     //client.subscribe(g_mqttTopic);
  18.     //SignStixDebug.info("subscribed to " + g_mqttTopic);

  19.     client.publish(g_mqttTopic, g_mqttPayload);
  20.     SignStixDebug.info("sent: " + g_mqttPayload + " to topic:" + g_mqttTopic);

  21.   });

  22.   //client.on("message", function (topic, payload)
  23.   //          {
  24. //
  25. //    SignStixDebug.info("received MQTT. topic:" + topic +" payload:" + payload);
  26. //

  27.   //this is closing the client connection
  28. //client.end();

  29.   //
  30. //  });  

  31. }

  32. SignStixNotify.notifyOnSignAppeared("onSignAppeared");