Protocol Adapters

Ably Client Library SDKs are the recommended method for connecting to Ably because they offer support for a comprehensive set of Ably features, such as automatic connection management, authentication token renewal and presence.

Protocol adapters offer an alternative method for connecting to Ably. The advantage to protocol adapters is that they require fewer resources in terms of memory and network overhead such as in smaller footprint devices, or on a platform where an Ably Client Library SDK isn’t available such as an Arduino-based IoT wearable. The potential drawback to consider when evaluating protocol adapters is that they do not support the full set of Ably features, for example the MQTT protocol adapter does not support presence, and the SSE protocol adapter does not support automatic token renewal.

A full list of Ably Client Library SDKs can be found on the SDK page, and features supported by each SDK can be found in the features matrix.

There are two available protocol adapters for use with Ably:

  1. MQTT
  2. SSE

MQTT is an OASIS standard messaging protocol for the Internet of Things (IoT). It is designed as an extremely lightweight publish/subscribe messaging transport that is ideal for connecting remote devices with a small code footprint and minimal network bandwidth.

The Ably MQTT protocol adapter provides an interface between an MQTT client and Ably. Being a protocol designed for small systems and IoT devices, MQTT has a low overhead in terms of system resource requirements. MQTT libraries are widely available, and support a range of languages such as C/C++, Python, and Rust. Because of this, client platforms and programming languages where an Ably Client Library SDK is not available, can still access the Ably platform through the MQTT client and the Ably MQTT protocol adapter.

MQTT clients can subscribe and publish to Ably channels. Any client that supports MQTT can therefore leverage Ably’s realtime network, with some constraints.

For more information on Ably’s MQTT protocol adapter see the MQTT documentation.

Server-Sent Events (SSE) is a functionality built into all modern browsers. Because SSE support is built-in, it does not require the loading of any additional libraries, such as is the case if you were to use the Ably JavaScript Client Library SDK. The Ably SSE protocol adapter allows the browser to subscribe to a realtime stream of events from an Ably channel.

In addition to the SSE endpoint, Ably also provides a raw HTTP streaming endpoint. This is similar to the SSE endpoint, but uses JSON envelopes instead of SSE events.

Note that SSE is for subscribing to events only and you cannot publish to a channel. You will have also to handle certain operations in your client code, such as token renewal.

For more information on Ably’s SSE protocol adapter see the SSE documentation.