Skip to main content

Message formats

Connhex Message Policy (CMP)

The best way to send messages to Connhex Core is by following the Connhex Message Policy. This page describes the lower-level base formats that are compatible with Connhex - use these only if the CMP isn't suitable for your needs.

Connhex requires all messages to be structured according to one of these two formats:

If your application isn't compatible with any of these, look at Other formats.

Choosing an appropriate message format

If you're creating a new application and you're sending data that can be represented as timeseries, we strongly suggest choosing the SenML format. If you want to connect existing devices already on the field, the simplest solution might be using the current format: JSON is the most common option.

In the following sections, we have listed some pros and cons to each format - keep reading for some guidelines on how to choose the most suitable format for your use case.

SenML

SenML is a format for representing simple sensor measurements and device parameters. Its purpose is to describe sensory information (temperature readings, pressure measurements, geo-localization, etc.) in a unique way.

What SenML tries to solve is the problem of interoperability: the IoT world is still in a divergent phase, where most of the systems are pretty much closed and everyone has its own data format and standard. Among all the different IoT "languages", SenML wants to be the one that everybody can understand.

Moreover, SenML can be used to efficiently handle batches as well as time series: for example, it supports multiple measurements to be batched into a single request, allowing the server to support a large number of devices.

If you're interested in the SenML format, check out our specification page where you can find examples and more details about the standard.

JSON

JSON is a widely used format: in fact, it is probably how your devices are communicating right now. This is why using the JSON format can be a sensible choice if you plan to connect devices already in the field - especially if updating their firmware proves to be inconvenient.

Performance degradation

Using the JSON format will inevitably lead to the loss of database-related optimizations that Connhex applies when the SenML format is used.

Other formats

Many devices use different communication formats: think for example of custom binary formats to reduce data transfer rates, or legacy text-based formats.

Connhex can handle all of these cases by integrating format adapters: these are translation layers that are straightforward to integrate, thanks to Connhex's expandability. Incidentally, this is how we handle situations where devices communicating with different message formats are connected to a single Connhex instance.

For additional information, just get in touch at connhex@compiuta.com: we can develop an adapter for your specific use case, or provide guidance on how to do it yourself.