BBM Enterprise SDK is now BlackBerry Spark Communications Platform. Learn more, and download it for free at BlackBerry.com/Spark.
The BlackBerry Spark Communications Platform provides a powerful, real-time, and secure messaging framework that can be used for much more than simple peer-to-peer text messaging. Message payloads are fully customizable, allowing an application to share all manner of information amongst groups of users.
Customizable Message Payloads
Each chat message in Spark protocol carries a specific “tag” which can be used to filter messages. Furthermore, the message itself can carry any arbitrary JSON payload, allowing one to communicate all manner of data or meta-data that can be serialized to JSON, in a chat. The data can include anything, such as including base64 encoded binary data, up to a maximum of 70 KB for the message in its entirety (this includes other message properties, the “thumb” for file transfers, etc)
Example: Sharing Location Data
In the Location Sharing example, we take advantage of Spark’s customizable message payload capability to share real-time location updates between chat participants. A custom tag “Location” is defined to identify these application specific data types, and messages are sent with a JSON payload that includes the user’s current location. The application then parses incoming messages, and renders the participant’s location data points on a map.
Send Location Updates to a Chat
To send a location update to a chat, we create a JSON serializable dictionary containing our location data and any other pertinent information. This information is then sent, as a message, to the appropriate chat.
//Construct a dictionary that can be serialize to JSON
Location data is just one example of a custom message type that can be sent in a chat. The possibilities are endless:
A custom message can be inserted into a chat by the initiator whenever a BBM Enterprise audio or video call ends which can then be used to render a call log.
An application can observe the user’s calendar and automatically send upcoming meeting notifications in a chat.
An application can implement a custom shared whiteboard by sending vector drawing instructions in the message payload
A Note On Reactive Programming
Spark provides a reactive programming framework to facilitate writing User Interfaces that are responsive to changes in the data model. The ObservableMonitor class provides a powerful way of reacting automatically to changes on “observable” properties. By simply wrapping the code that queries for the custom message in a monitor, we can have that code block execute automatically any time the list of messages changes.
functioning of the site, while others are to help us understand how you use it. Read more here about our cookies, and how you can