Webportal v1

embedded apps

API Reference - WebPortal.MQTT.evt.messageReceived

WebPortal.MQTT.evt.messageReceived

Type Event

Event triggered when the MQTT message has been received.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
window.addEventListener("message", function(event){

  if (typeof event.data !== 'undefined' && typeof event.data.type !== 'undefined' ){

    var data = event.data;
    var type = event.data.type;

    switch(type){
      // When the MQTT message has been received
      case "WebPortal.MQTT.evt.messageDelivered":
        console.log("The MQTT message has been received");
        alert("The MQTT message has been received");
        break;
    }
  }
});