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 we get loosely coupled systems, natural encapsulation and software reuse across apps and departments.

The current API trend is to offer transactional request and response APIs, where 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?

Real-Time APIs

Real-time 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. Without further ado, here are the five reasons why you should have a real-time API.

1. You have Real-Time Data. Use it!

Whether you know it or not, you definitely have real-time data within your systems.

I’ll go into this in more detail in future posts, but the fundamental idea is that 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

This is a simple one!

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 they really want 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 has a Time Factor

Imagine the next big As A Service being Warp Core as a Service. This service manages your warp core for you, so you don’t have to, and it exposes an API to give you the power to control it.

The Enterprise Warp Core - Hard Real-Time

The safety notifications API really needs to be a real-time API because if there’s a warp core breach in process you really need to know about that instantly. If that API isn’t real-time then it’s saucer separation time!

There are real world examples of APIs that have to be real-time because the associated data has a time-factor and constraint between the event occurring (e.g. the service detects a warp core 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 & Empowerment

Back in 2012 I was invited to talk at the Business of APIs event in London. As an evangelist I was asked to give a five minute talk with the title What Developers Want. I unsurprisingly said that Developers Want Real-Time.

Of course, I think real-time technologies are amazing, but I also believe that a real-time API offers a much nicer developer experience as well as empowering them to be able to do so much more.

A developer polling your API 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 developer experience that can significantly reduce application processing overhead and code complexity.

Once the data is being pushed to the system the developers are building you are empowering them to focus on building value into the product. Which really leads me into my next point.

5. Users Expect Real-Time Experiences

Users do expect real-time experiences and this has been the case for quite some time now – but it is worth re-iteration. The applications that a large number of users interact with on a daily basis provide real-time experiences. The standard has been set!

Facebook is full of real-time features; the main wall has a real-time factor, they have an activity stream area to their UI that constantly updates with friend activity and their chat functionality (Messenger) is as popular as ever, resulting in a dedicated spin-off application. All of these provide real-time experiences.

UserVoice is a highly popular customer support solution where users – support desk agents and customers – benefit from instant feedback and communication, all resulting in a great user experience for everyone.

uservoice

Google Docs is the go-to example for real-time collaboration. 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 in real-time. The popularity of our Atom Pair collaborative coding package confirms this.

Uber instantly updates you on the location of your taxi and when you should expect to be picked up. This is a massive improvement on the previous experiences we’ve had with taxi services and has revolutionised an industry.

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

So, if you’re not offering a real-time API you’re stopping your API consumers from adding highly valuable real-time experiences to their applications.

Putting it into practice: setting up your Real-Time API Infrastructure with Pusher

A number of our customers started off using Pusher to simply add real-time functionality to their web, mobile or IoT apps. However, some of them such as Travis CI have also exposed that data to their own customers, using Pusher as their real-time API infrastructure. Others such as Bitstamp, CEX.IO, SoChain have used us as API infrastructure from the beginning. We’ve also built example real-time APIs, such as ones for the Product Hunt API, Reddit API and Traffic For London API.

Publishing data via Pusher is as easy as:

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

And consuming the data is as simple as:

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

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

So, if you’re interested in using Pusher as your real-time API infrastructure why not sign up and find out just how easy and empowering it is. If you’ve any questions at all please don’t hesitate to get in touch with me directly.

Set your real-time data free using a Real-Time API

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

What are you waiting for?

About Phil Leggetter

Phil Leggetter is a head of developer evangelism at Pusher. He's been building and using realtime web technologies since 2001 and is excited about the use cases and the potential for the technology as ever.