This is the fifth part of our series on push technologies. In part four, we looked at a number of alternative push alternatives. In this part, we will look at some turnkey push API infrastructure providers.
The previous parts of this series have helped you become familiar with various kinds of push technologies. Of course, a technology isn't an implementation and you require an implementation to do anything productive. Creating an API is the next step after you decide on a technology. The API provides the means for your applications to use the underlying technology.
It's possible to create your own push API from scratch. For that matter, you could even take a building block approach to the task; using other people's libraries to put an API together without much more than a little glue code. However, if you create your own solution, even one involving black boxes, you're stuck maintaining the API code yourself and push technology evolves incredibly fast. Few organizations could find the required staff, never mind bear the costs of creating a custom push API setup. So, the best alternative for many will be to use a turnkey solution.
Usually, you'll find that there is a tradeoff between custom and turnkey solutions in the form of flexibility. A custom solution is guaranteed to fulfill your needs and to change as you change. With a turnkey solution you'll often get someone else's idea of what you need, which may not be what you want at all. Fortunately, there are enough turnkey API infrastructure providers that flexibility really isn't a problem. It's likely that you can find a solution that meets your needs almost precisely. This part of the series helps familiarize you with some of the turnkey push API infrastructure providers.
Socket.IO
Socket.IO is a JavaScript API that provides bidirectional communication between client and server. This solution is based on a combination of WebSockets (see Part 3) and polling. It provides you with basic communication, but leaves other details, such as security, to you. The focus of this product is to provide you with both reliability and speed. A common comment about this particular solution is that it's easy to use. Because this product is at the low end, you'll also find it used as the basis for other products from vendors who want to provide additional functionality. Common application uses are:
- Real time analytics
- Instant messaging and chat
- Binary streaming
- Document collaboration
- Presentation
You can see demonstrations of both a chat and a whiteboard application on the Socket.IO site, along with the product documentation. The support you receive is on par with any other product online. If you're really uncertain as to how to start, the Getting Started page provides a tutorial to write a chat application. The design of this page seems to infer that there will be other tutorials added later.
In order to create an application, you use Node Package Manager (npm) to install a Node.js library on a server. The client makes reference to that Javascript library. Both server and client rely on an event-driven interface to perform interactions. Either server or client can broadcast to multiple sockets. In addition, the package supports asynchronous communication. End user products such as Microsoft Office, Yammer, and Zendesk rely on Socket.IO for communication. The one major downside to this product is that you can't use it with non-socket clients, such as Comet.
PubNub
PubNub is a JavaScript-based publish/subscribe messaging API built on a Data Stream Network (DSN). This product is designed to interact well with a large number of APIs. In fact, there are 70+ SDKs that PubNub supports. If you click on one of the SDK links (many of which abstract other APIs), you'll find information about that particular SDK/API, along with example code. The code is broken into smaller pieces to create a tutorial-like effect (but these code snippets still require some time to understand).
In addition to supporting a lot of different API environments, you can find PubNub everywhere, including board-based computing environments, such as Raspberry Pi, Arduino, Texas Instruments, and Microchip. Common application uses are:
- Publish/Subscribe messaging
- Online presence detection
- Access management
- Data stream control
- Storage and playback of messages
- Mobile device push notifications
It can also work alongside Socket.IO and potentially other real time backends using the rltm.js API. The idea is that you can switch between the advanced features offered by PubNub and the simplicity offered by Socket.IO as needed while using a single code base. PubNub does provide some helpful tips about using the two products together, such as pointing out that Socket.IO sends online/offline status notification messages that can cause potential performance problems. Obviously, there is a strong emphasis on eventually moving toward a PubNub-only solution.
PubNub BLOCKS is a big part of the overall product. It lets you control message flow without having to build your own infrastructure to do it. It looks as if BLOCKS is a really big deal because of the incredible number of ways vendors use it. Depending on your perspective, some of these applications seem nearly impossible to do in real time, such as translating text into multiple languages simultaneously and turning sensor data into real time visualizations. A few of the applications are just for fun, such as adding GIFs to chat messages.
Streamdata.io
Streamdata.io is a REST-based real time cache that lets you to poll APIs using JSON requests and push updates to clients. One of the features that sets Streamdata.io apart is that it maintains a list of changes that occur between two polling events. In this way, your application receives only the data changes, which means that Streamdata.io can perform tasks quicker than some other providers. The setup works as a PubSubHubbub configuration as described in Part 2 of this series (but with a REST twist). However, one of the best features of Streamdata.io is that it works in a number of environments including:
- JavaScript
- Android
- Node.js
- iOS
- Java
- .NET
- HTML
- CSS
- Objective-C
The Streamdata.io site and GitHub provide you with examples of all of these environments, along with a great many others. The point is that you could use this one environment to support your application in a number of different environments using essentially the same code base for each environment. What you end up with is an application that looks and feels the same wherever you use it.
Getting started with Streamdata.io is relatively straightforward if you can follow the instructions provided on their site. What you're seeing is a five step process, but three ways to accomplish the five steps. Steps 2, 3, and 4 vary by the way that you create a connection to Streamdata.io. You find sample code at the bottom of this page, which is really helpful in getting started. Streamdata.io is a Google technical partner, and it has also partnered with Restlet and Mashape (now Kong). You also find it used with these company's products:
- BNP Paribas
- AXA
- La Poste
- Betclic
- La Société Générale
- Schneider Electric
- Custom Sensors & Technologies Inc. (CST)
Ably
Ably focuses on helping you add real time messaging and streaming data to your application. The best part about Ably is that it doesn't focus on just one way to get the job done. The provider uses four kinds of support along with a real time core to achieve some pretty interesting results:
- Smart Notifications: Most push notifications are intrusive because they simply appear on a user's device. However, Ably makes it possible to push content subtly by relying on the user's connection state, their active device, and their current context within your application. This means that the user still gets the information, but in a less intrusive manner.
- Protocol Adapters: In order to provide the advanced functionality that it does, Ably relies on a native real time protocol. Of course, you probably already have protocols that you prefer. The protocol adapters serve to make the transition from your protocol to the Ably protocol seamless.
- Reactor: You have two choices in running code when working with Ably: on your server or in a serverless environment. In either case, you need some method of interacting with data. The Reactor Queues service makes it possible to obtain data from your own server, while the Reactor Firehose service makes it possible to stream data from a third party such as Kinesis or Kafka.
- Exchange: This piece of the support puzzle is a work in progress.
These four kinds of support let you perform various tasks in a number of ways. For example, you can support messaging in these ways:
- Pub/sub Messaging
- Message History
- WebHooks Push
- Smart Mobile and Browser Push Notifications
- Message Queues
- Multiplexed WebSockets
From the previous parts of this series, you know that each of these methods of pushing data uses a different technique. In addition, each method comes with pros and cons that you must consider when implementing them in an application. By using Ably, you can create an environment where you use the same provider no matter which technique works best. Ably provides you with an amazing number of tutorials to show how all these methods work, along with implementation documentation that's actually quite easy to follow and provides usable example code. You also have access to some interesting real world examples to complete the picture. The part you'll like best about Ably though is that they're up front about the nuts and bolts of implementing solutions. For example, they won't try to soft sell you on their Health Insurance Portability and Accountability Act (HIPAA) compliance. Organizations that currently use Ably include:
- Yahoo!
- CA Technologies
- Actively Learn
- OnePulse
- OfferUp
- Shoelace
- Codewars
Fanout
Fanout is a push Content Delivery Network (CDN) that makes it possible to use multiple servers to output data. Each server focuses on just those clients that are closest to it in order to reduce the latency associated with distance. This provider lets you use a number of technology solutions including: REST, HTTP streaming, WebSockets, Webhooks, and XMPP. The actual product relies on a JavaScript library that passes JSON messages.
Unlike the PubSubHubbub configuration described in Part 2, Fanout doesn't really act as a hub. In order to get content, a client still contacts your server. Your server then sends content and a list of clients to Fanout, which then publishes the content for you. However, you still gain a significant speed boost and reduce costs by having to transmit data to only one location. Fanout does support an interesting assortment of languages:
- Python
- Ruby
- PHP
- Node.js
- Go
- Django
You can also find an impressive number of customers using Fanout, including Mozilla, LaunchDarkly, and Superfeedr. However, unlike a lot of products out there, Fanout actually has a number of personal reviews written by the developers of the companies it supports. As with most of these turnkey solutions, you should expect to pay something for the service when you use it for business purposes. However, you also have access to a free hacker plan that makes it easy to try before you buy.
Hydna
Hydna is a hosted backend that you use to transmit data to various devices. The transport mechanism lets you use WebSockets, Binary TCP, HTTP, Comet, and Flash. A middle layer called behaviors makes it possible to distribute the data intelligently using small scripts. The routing portion of the service makes it possible to send the data where needed and as to many devices as required. You see Hydna used in a number of application types including:
- Dashboards
- Activity streams
- Notification-systems
- Chat systems
- Real-time collaboration
- Live statistics
- Remote controls
- Multiplayer games
You can see a number of these applications demonstrated on the Demos, Projects, and Case Studies page. Using the free account lets you experiment with everything but the encryption feature. A number of companies are using Hydna as part of their solution:
- Ericsson
- Universal
- Adobe
- Medifestivalen
- AftonBladet
- Sveriges Radio
Like most other turnkey solutions, this one supports a wide range of languages. In fact, you may find the list a bit overwhelming. Most languages provide complete support. However, it's important to note that some languages, such as Python, Ruby, PHP, and Go provide push-only support. Consequently, it's important to choose the language you use with Hydna carefully.