Tutorial: The Real Time API

Tutorial Real Time

Traditional APIs operate on a request and response message pattern.  In this tutorial we will integrate real time messaging in to our API and make use of these capabilities in a non-typical use case.

This article is part of the ‘Developer Series’ and is intended for software developers undertaking the challenge of correct API design.  Throughout the series the developer will gain knowledge and build confidence around the industry practiced methodologies relating to the planning, design and development of application programming interfaces.

Most traditional APIs only take action when the browser or client requests information or action from the API.  This request/response type pattern has been the successful foundations of many client/server topologies, web applications and APIs.  There is another category of API which interacts with the client in real time requiring nothing more than an open connection.

Media AnalyzerIn this tutorial we will build the media analyzer on the left and as with previous tutorials we will demonstrate a number of key features, such as:

  • Serving static files
  • Real time interaction
  • Binary file streaming

Our API will be used to allow a user to upload an audio file and have it analyzed by the API.  During the upload our API will report the transfer progress from the API after a chunk of data has been written to the disk.  On completion the audio waveform will be analyzed and its peaks transmitted to the browser where a waveform is plotted in real time.

The code for this tutorial is located in YourAPIExpert’s GitHub Repository.

Next Up:  Serving Static Files

Pages: 1 2 3 4

Written by YourAPIExpert