Client side – How to use WebMsg widget
UNICOM® Digital Transformation Toolkit (UDTT™) provides a hidden widget WebMsg for client-side usage.
1 Set properties of WebMsg. WebMsg has these properties:
▪ uid, the user id of this terminal/browser, leave it empty to avoid receiving private message(send via sendPrivateMsg method)
▪ Topics, the topic list which this user is interested in, will receive the message send to the topics(send via publishMsg method)
▪ receiveBroadcast, set this to true to receive broadcast message(send via broadcastMsg method)
2 Listen to the inbound web message via listening onWebMessage event of WebMsg widget in ECA rule editor
▪ Web Message Object can be used in condition(editor) and action(editor) of ECA to handle the received inbound web message. It has two properties:
topic: the topic name of the received message
value: get the message value via this function property, it need the qualified ID of the attribute in the message
For example:
for the message, {type:”example”, data:{field1:”f1”, field2:false}}
The qualified ID of field1 is : “data.field1”
See also