About Messages¶
Messages may be published in different data types and formats. For example, a message can be a primitive value (i.e. a number or a string) or a complex object structure, it could be a JSON object published by a JS or a REST client or a Java object published by an Android or Java app. Adding to the mix iOS publishers and business logic (Cloud Code) which can also publish messages creates a wide variety of possibilities for what a message may look like. The subscriber API offers the flexibility to receive messages which are cast to a specific data type or messages represented in the internal Backendless format. The latter provides access to additional metadata, such as publisher ID and headers.
It is important for both publisher and subscriber to "agree" on the message format. For example, if published messages are strings, the registered listener should be expecting strings. If the published messages are objects of a particular type, the listener should be coded to receive objects of that type.