Developer Onboarding Guide

Chapter 2

Fundamental features of the Ably Data Stream Network

1. Ably Realtime and Ably REST Client Library SDKs

Ably's Data Stream Network (DSN) primarily offers realtime Client Library SDKs that allow you to incorporate the Pub/Sub messaging pattern in your apps and operate any number of such persistent publisher or subscriber clients.

However, in many scenarios you may not need persistent connections. Most servers are typically stateless and hence HTTP based REST requests better suit them in order to be able to process each request independently. In many other situations, for example, if you have an IoT sensor that only needs to publish data at certain intervals, you’re better off with a REST request rather than maintaining a persistent connection which leads to battery-drain. For scenarios like this, Ably also offers REST-based Client Library SDKs.

Our best practice guide further explains when to use which library.

2. Authentication

Ably requires your clients to authenticate before accessing the Ably Network. We provide two ways of authenticating your clients:

  • Basic auth enables your clients to directly plug in API keys. This is quick but not recommended for production level apps, as API keys are vulnerable to misuse when embedded in client-side code.
  • Token auth enables you to assign short-lived tokens to your clients, which they can use to authenticate with Ably. This can be an Ably-specific token or a JSON Web Token (JWT). Token auth is a safer and recommended option to use in production level apps.
Here’s a 5-minute video with a detailed explanation on authentication with Ably:

2. Presence

Presence tells you who is connected to your application and what their status or attributes are. You can use presence in two ways:

You can also retrieve the historical presence status of your clients using the History feature described next.

3. History

Maintaining strong, persistent internet connections isn’t always an option. And sometimes when a client disconnects from the internet, they might miss any messages sent during that time. To overcome this, Ably persists messages for two minutes by default.

This is configurable to durations of up to 72 hours by using a feature called History. Any client that manages to reconnect during that period will receive any missed messages in the order they were originally sent.

Up next: An overview of Ably's products →

Find the team online: