An Intro to Realtime APIs Using Pushpin
In this article, we briefly introduce Pushpin, a proxy server for creating Realtime APIs and push notifications, and explain how to use it with your web app.
Join the DZone community and get the full member experience.Join For Free
Realtime APIs are at the center stage of web and app development because more and more users expect realtime experiences. The traditional transactional request and response APIs may work if you don’t need up-to-the-minute data, but if you broadcast live triathlon results, you know your users want realtime updates to the scoreboards (an actual application by the way).
There are many popular realtime services that developers can use like Pushpin, Pusher, and Streamdata.io. If you’re truly interested, the ProgrammableWeb offers a large API Directory with more examples of realtime APIs and others.
This article introduces you to realtime APIs with Pushpin, a drop-in reverse proxy server that pins clients’ connections open, making realtime push easy. Here is an example of how Pushpin fits into an application structure:
Pushpin Pushes Data
Pushpin, a reverse proxy and open-sourced version of Fanout, is dropped between the backend web server and client. It then communicates with the backend using short-lived HTTP requests. After the backend gives a confirmation to push the data, Pushpin’s private control API will push the data by making an HTTP Post request. Pushpin will then send this data to the clients’ connections as necessary.
Pushpin is also a unique realtime push solution because it addresses API creators’ needs:
Pushpin With API Management
Pushpins’ architecture allows it to be easily integrated into a team’s current API management system. Many API management systems function as a proxy server already, a developer would just need to connect the proxies together. Pushpin is also placed in front of the API management system so that the system doesn’t undergo long-lived connections. And since Pushpin can translate WebSocket protocol to HTTP, the API management system can operate on the translated data easily.
All in all
An open source API like Pushpin promotes collaboration and innovation by allowing developers to experiment with new integrations. In the coming weeks, I’ll explain more uses of realtime APIs using Pushpin and other API tools. Check out my profile for more.
Published at DZone with permission of Jeffrey Lee, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.