5 reasons why you should have a realtime API

Still-polling_1.png

Get valuable data to your apps faster, empower your developers to build essential realtime experiences, and be instantly informed of important events.

Introduction

APIs offer a number of benefits. From a business point of view they encourage innovation, wider adoption and the potential for partnerships. From a software architecture standpoint you get loosely coupled systems, natural encapsulation and software reuse across apps and departments.

Transactional request-response APIs have been a popular method for data delivery in the past. In this scenario an interaction with the API makes a request for data of some kind, the API does some work and then returns the response. But what happens when new data becomes available within the systems behind the API? What if the request had been made just moments later?

Realtime APIs

Realtime APIs address this problem. Instead of the API consumer only getting the new data upon their next query, the new data is instantly pushed to them. This simple difference has profound ramifications for developers, businesses and their customers. There has been a huge increase in the adoption of realtime APIs in the last few years; as they have become more powerful, older methods of data delivery have decreased in popularity. Here are five reasons why you should really have a realtime API.

1. You have realtime data. Use it!

Whether you know it or not, you definitely have real-time data within your systems. You can easily identify the real-time data within your systems as the following:

  • Any changes in data; commonly identified by some kind of CRUD action or interactions with a data store.
  • Any interaction between systems.
  • User interactions with applications and systems.

Each of these events has an associated data payload that could easily be exposed via a real-time API and consumed by apps that want to display real-time data or offer real-time functionality.

2. Faster access to business value

You’re exposing an API already so that API consumers (other internal systems or external third-parties) can get access to data and gain value from it. The faster the data can be accessed and processed, the faster its value can be extracted and gained.

If a developer is already polling your API for changes in data, it’s a heavy hint that what they really want is a real-time API. They want the data to be pushed to them so they can get value from it as soon as possible.

Get the data to your customers as fast as possible!

3. Some data is intrinsically time sensitive

The safety notifications API, for example, really needs to be a realtime API. If there’s a breach in process you really need to know about that instantly.

There are real world examples of APIs that have to be realtime because the associated data has a time-factor constraint between the event occurring (e.g. the service detects a breach) and that event being received by the API consumer. These real world examples include:

  • Monitoring systems; where the sooner the API consumer gets the data the sooner they can act upon it
  • Market data & betting; where the time from the event taking place to data being received is valuable in monetary terms
  • Communications; where users or systems are attempting to interact in real-time and any lag in communication can represent a communications break down
  • Collaborative experiences; where one or more users are working together on a shared project and any missed or late changes can result in duplication of effort and wasted time
  • Real-time user experiences (UX); where an action should provide instant feedback; from real-time chat to pressing a button in a mobile app to unlock an IoT connected door, these experiences need to be instantaneous

4. Developer experience and empowerment

Realtime APIs offer a much smoother experience and empower developers to be able to do so much more.

If a developer is polling your API, it doesn’t just mean they want faster access to your data. It’s also a very clear indication that having the data pushed to them would be a much nicer experience that can significantly reduce application processing overhead and code complexity.

Once the data is being pushed to the system in realtime you are empowering developers to focus on building value into the product.

5. Users expect realtime experiences

Users expect realtime experiences. This has been the case for a long time now – but it is worth re-iteration. The applications that a large number of users interact with on a daily basis provide realtime experiences. The standard has been set.

Facebook, Twitter, Instagram and other popular social networking sites are full of realtime features. The main feeds themselves are key realtime factors: an activity stream area to the UI that constantly updates with friend activity.

Google Docs is the go-to example for collaboration in real time. Long gone are the days of sending around multiple revisions of a document and “tracking changes”. Simply get a draft in place, share a link and collaborate together. With remote working on the rise, effective collaboration tools are more vital than ever.

Uber instantly updates you on the location of your taxi and when you should expect to be picked up. This has revolutionised the industry, and with competitors including Lyft, BlaBlaCar, Ola and more popping up left, right and centre, demand for this feature isn’t showing any sign of slowing. The live location feature has also been widely adopted for delivery services so users can easily stay up to date on exactly when their package or food order will reach them.

These features are fundamental to the success of these applications. All powered by realtime. All offering a significantly improved user experience thanks to realtime.

If you’re not offering a realtime API you’re stopping your consumers from adding highly valuable realtime experiences to their applications.

Putting it into practice: setting up your realtime API infrastructure with Pusher

A number of our customers use Pusher to simply add realtime functionality to their web, mobile or IoT apps. Some of them have gone on to expose that data to their own customers, using Pusher as their realtime API infrastructure. Others have used us as API infrastructure from the beginning, and we’ve also built example realtime APIs.

Publishing data via Pusher is as easy as:

pusher.trigger('data-identifier', 'data-event', { your: 'real-time data' });

And consuming data is as easy as:

1var pusher = new Pusher(KEY);
2var channel = pusher.subscribe('data-identifier');
3channel.bind('data-event', function(data) {
4   var value = data.your;
5});

The Pusher subscription authentication mechanism also makes it really easy to control who can access your data.

Every application has realtime data so why not expose it via a realtime API? You can get valuable data into your apps faster, share it with your customers, be instantly informed of important events where time really matters, improve the experience that developers have when using your API and empower them to build essential but amazing user experiences.

If you’re interested in using Pusher Channels as your realtime API infrastructure why not sign up and find out just how easy and empowering it is.