EdcMessage Data Type

EdcMessage provides an abstraction over the messages sent in and out of the Everyware Cloud platform. It encapsulates all the information regarding the message: the topic it was addressed to, the timestamp when it was received by the platform, and the payload contained in the message. The payload can be represented by a raw binary array or by an EdcPayload object if it was formatted as such when the message was composed and sent. Refer to the EdcPayload documentation for more details on how EdcPayload are modelled and how they can be constructed.
The EdcMessage class is used both by the messages/search API to return message results from the platform, as well as by messages/store and messages/publish API to send messages to the platform.

Properties
name data type description
topic string The topic to which this message is sent to. A generic Publishing topic can be represented as accountName/assetId/semanticTopic where:
  • accountName is the name of the Everyware Cloud account owner.
  • assetId is a unique ID representing a particular asset (either the application or the sensors from which the data has been gathered).
  • semanticTopic is the section of the topic used to further specify information about the device or data, using an hierarchical name space representation.
System and control topic starts with the $EDC account and are represented as: $EDC/accountName/assetId/semanticTopic.
receivedOn number The timestamp when this message was received by the platform. This timestamp has to be distinguished from the timestamp when the message was sent to the platform, which applications can capture in the EdcPayload timestamp field. In the case of the REST API messages/store and messages/publish, the value provided in this field is ignored and a server-side timestamp will be used.
payload EdcPayload The payload of this message as EdcPayload object.
uuid string The uuid of the published message.
payload string The raw binary array of the payload if this message payload was not formatted using the EdcPayload object.
edcTopic EdcTopic

Example

{
  "topic" : "...",
  "receivedOn" : 12345,
  "payload" : {
    "sentOn" : 12345,
    "position" : {
      "longitude" : 12345.0,
      "latitude" : 12345.0,
      "altitude" : 12345.0,
      "precision" : 12345.0,
      "heading" : 12345.0,
      "speed" : 12345.0,
      "timestamp" : 12345,
      "satellites" : 12345,
      "status" : 12345
    },
    "metrics" : {
      "metric" : [ { }, { } ]
    },
    "body" : "..."
  },
  "uuid" : "...",
  "edcTopic" : {
    "systemTopic" : true,
    "edcTopic" : true,
    "alertTopic" : true,
    "account" : "...",
    "asset" : "...",
    "semanticTopic" : "...",
    "leafName" : "...",
    "parentTopic" : "...",
    "grandParentTopic" : "...",
    "fullTopic" : "...",
    "topicParts" : [ "...", "..." ]
  }
}