In this section, we'll see the data format required to stream messages from server to the client. Each real time update of the gauge can contain 1 message to be added to the logger. The following attributes in the real-time data stream help you to do so: Note, that the messages to be logged should be provided in the real-time data stream and not the XML document. Real-time data stream refers to the data provided by the URL specified in dataStreamURL attribute. |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
Examples of real-time update | ||||||||||||||||||||||||
Shown below is an example of real-time update string passed by server to the message logger (contained in an angular gauge in this example): &label=10%3A44%3A15+AM&value=23|54&msgTitle=OS update at 12:28&msgText=Operating system update downloaded automatically. Installation in-process. Reboot due in 8 minutes. Here, we first have the &label and &value parameters, which are absorbed by the gauge for data update. Thereafter, we've the msgTitle and msgText parameters, which get absorbed by the message logger. Here, we have set a title - "OS update at 12:28" and text - "Operating system update downloaded automatically. Installation in-process. Reboot due in 8 minutes". When a gauge (with message logger set as on) accepts this data stream, it will be displayed as shown below: |
||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||
Note: If you're passing any special characters as part of your message text or title (like &, % etc.), you need to URLEncode the text/title.
|
||||||||||||||||||||||||
Changing Message Type | ||||||||||||||||||||||||
As we had discussed earlier, you can choose a message type for each message as INFO, ERROR, LITERAL, or LINK. This helps your end users easily recognize the type of each message Shown below is a simple example using message type as error: &label=10%3A48%3A28+AM&value=23|54&msgTitle=Alert at 12:24&msgText=Server Alert Id: 33456. Temperature of zone 1 exceeded pre-set threshold 1.&msgType=ERROR When a gauge reads this, it'll display the message as shown below: |
||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||
If a message type as Literal, it will display the message as shown below: | ||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||
Creating messages with link | ||||||||||||||||||||||||
If you want to display a message as link, set msgText of that message as the entire link (URL-Encoded) and msgType to LINK. Shown below is a simple example of creating messages with link: &label=10%3A59%3A44+AM&value=23|54&msgTitle=Test Link&msgText=http%3A%2F%2Fwww%2Efusioncharts%2Ecom%3Fid%3D34&msgType=LINK In the above example, we're linking the message to http://www.fusioncharts.com?id=34. We've URL-Encoded the link, as it contains special characters (? in this case). While specifying a link message type, the link itself is displayed as the message text. You cannnot change the message text. This will yield the following output: |
||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||
Linking custom text | ||||||||||||||||||||||||
If you want to show your own text as message and then link it, there's a work-around. Set msgType to INFO and provide the entire link in HTML code as part of msgText. To specify a link, you need to output the HTML code for link as msgText. Add <U> tag in HTML code, if you need to underline the link. Finally, URLEncode the entire msgText parameter and then stream to the gauge. Shown below is a simple example of linking custom text: &label=11%3A02%3A56+AM&value=23|54&msgTitle=Test Linked Message&msgText=%3CA+HREF%3D%27 In simpler form (i.e., before URL Encoding), this stream reads as shown below: &label=11%3A02%3A56+AM&value=23|54&msgTitle=Test Linked Message&msgText=<A HREF='http://www.fusioncharts.com?id=34'><U>Server Alert Id: 33456. Temperature of zone 1 exceeded pre-set threshold 1.</U></A>&msgType=INFO When you view this in the gauge, you'll get the following result: |
||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||
Clearing Message Logger from server | ||||||||||||||||||||||||
From the server, you can instruct the gauge to clear the contents of visible message logger by sending the following command: &clearLog=1 It can be sent as a part of message stream, like: &label=10%3A48%3A28+AM&value=23|54&msgTitle=Alert at 12:24&msgText=Server Alert Id: 33456. Temperature of zone 1 exceeded pre-set threshold 1.&msgType=ERROR&clearLog=1 This clears all the contents of the existing message logger and start afresh. Note: If you send &clearLog=1 with each real-time update, the gauge wouldn't display any messages in the logger, as the log is being cleared with each update. As such, take caution to send this command only when log needs to be cleared. Additionally, you can also clear the message logger using client side JavaScript API, which we'll see in next section. |
||||||||||||||||||||||||
Next, we'll see how messages can be handled in JavaScript functions. |