RELAY: The Next Generation of Communications APIs

A secure, scalable, real-time API for building advanced communications applications.

Sep 10, 2019

By Evan McGee, CTO

A Quick History of Why we built RELAY

At SignalWire, we provide developers with the tools they need to build innovative communications applications. Thanks to our cutting-edge RELAY APIs, it’s easier than ever to build out your vision at the lowest price point in the industry. RELAY is a suite of APIs exposed via our software development kits that you can download and integrate instantly. It provides an easy, secure, and scalable way to do things like send SMS, make phone calls, start video chats and programmatically interact with all SignalWire services.

In order to create the most powerful communications platform, we’ve brought together some of the best & brightest people in our industry from around the world. Our team includes developers with exclusive knowledge of our core FreeSWITCH technologies joined by experts in consumer APIs, microservices, containers, and public cloud architecture to expose the power of telecom.

Our team shares a common experience: we’ve seen and solved the same problems with communications architectures again and again over the past 15 years. Companies around the world are hitting the same scaling roadblocks and wasting months or years on the same edge-cases or identical solutions. Now with the commoditization of global cloud computing, WebRTC in all major browsers, and smartphones as powerful as laptops, we see an inflection point - all those roadblocks disappearing into an elastic cloud communications company that provides disruptive pricing and lets companies innovate with their communications like never before!

The next communications revolution is here and SignalWire is ready to lead it. We are tired of people taking old technologies and trying to spin them off as something new and exciting -- so we built RELAY to move the industry forward. SignalWire unleashes advanced functionality that could only be created by a team with deep expertise and with a sole focus on making it easier for application developers to innovate by cutting down costs, building simpler APIs, and creating a powerful and scalable platform.

Our centuries of collective experience as the Original Geeks is being used to create simple and scalable technology that moves the Software Defined Telecom revolution forward. We have an intimate familiarity with the problems in this industry -- and that’s exactly why we are the ones to fix it.

RELAY Is Necessary

In the communications industry, REST APIs are showing their age. While a lynchpin of the modern Web, they have lagged behind in leveraging current advancements in cloud technology. Other communications API providers have grown complacent and reliant upon them. REST-based APIs alone do not fulfill the needs of modern developers creating advanced communications tools or products because they rely on traditional fire-and-forget HTTP callbacks, which dramatically limits interactivity and adds both latency and complexity to the development.

Back in the mid 2000s, REST (Representational State Transfer) was a revolution. A simplification of previous ideas, it used basic HTTP verbs to transmit one of five commands: GET, PUT, POST, PATCH, and DELETE. Being run-of-the-mill HTTP made these commands easily understood by web servers; you could shoot these requests over the internet to a remote server, let it do its thing, and then expect a nicely formatted response - all using the same technology used by a web browser. While great for many use cases, it’s not the most flexible. Modern developers are constrained by these five commands and frequently have to work hard to make their logic fit the basic one-at-a-time HTTP command paradigm.

We believe the future is a lot more flexible. In order to build advanced communications applications of the future, developers need more control. Instead of using decades-old HTTP to send data off into the web and get a response back, SignalWire’s RELAY API establishes a secure websocket. Think of a websocket as a secure tunnel between us and your application. Instead of firing off individual requests and waiting for a response, data is always flowing back and forth, constantly streaming both ways which allows for a much richer interaction to be done in real time. We only use encrypted websockets so there is never any need to worry about whether messages come from us or can be seen by others: they are for your eyes only!

RELAY Is Different

RELAY is perfect for programmers who build applications. By taking away the need for any additional infrastructure and letting you focus on code, it removes barriers to getting your app done. There is no needing to deal with tedious webhook callbacks, reverse proxies, or unsecured endpoints. With SignalWire, we power all of your communications so you don’t have to worry about scalability or resiliency; all you need to do is run your program anywhere in the world and we take care of all the complicated bits for you.

Using a Websocket eliminates some of the problems inherent with REST. With RESTful HTTP requests, each message is sent individually so they can be received out of order. For example, a request sent from New York to Los Angeles may go north through Chicago or south through Dallas, all depending on network conditions; this is what the Internet was meant to do! While that’s wonderful for things like email, it causes some weird problems with real-time communications.

Let’s say that you’re driving along and decide to make a phone call - you dial the number (hands free, of course) and right as someone picks up...the call drops. Thanks AT&T! If you were monitoring the call using REST, you may receive a bunch of independent messages all sent very quickly but come through different routes: the call <answer> goes up through Minnesota and is pretty congested, but the <hangup> goes down through Texas and is much faster so you end up getting the <hangup> before you get the <answer>. That doesn’t make sense!

Suddenly you can no longer rely on the fact that you’re getting messages in the right order, which is a big problem for those working in real-time media. The Internet was not designed to hold real-time conversations; it was built to always transmit data at any cost. Others have simply shrugged and said, “What can we do?” We’re here to say that guaranteed order in which you receive messages matters a great deal, and the RELAY websocket protocol is the answer to this problem.

Another important feature of RELAY is how simple we’ve made it to use. With other APIs, there is a lot of infrastructure that must be created and maintained just to be able to receive all these messages flying around. Sending and receiving REST is a well solved problem, but as you start to scale that and as the number of connections and traffic goes up, more and more resources are required to deal with that traffic.

If you’re receiving 20k messages a second, suddenly you can’t just stick it on one single server - you potentially have to deal with many servers, rate limiting, custom routing rules, and all the other headaches associated with large-scale HTTP automation. Now that you have all those services running you may need some kind of orchestration framework like Kubernetes to help manage the little machines themselves, or Ansible to spin up new ones when traffic spikes, and all of this requires people who know those technologies. Just like the warning on a side view mirror: services at scale are harder than they appear.

With RELAY, we’ve made it simple: we take all of that infrastructure and move it into our servers so you don’t have to worry about it. Say that you have too much traffic for one server to handle; your SDK is going full speed and can’t keep up. All you have to do is turn on two more and we take care of load balancing across all of them. If you want, you can even select which SDK subscribes to what type of messages and we take care of where the messages go; all you have to worry about is building your application, making RELAY a truly scalable solution that just works with you.

What can I build with RELAY?

You can integrate RELAY into your applications in any way you can imagine. Let’s say that you’re running a site that deals with appointments, like a doctors office, and your machine is calling Bob to remind him about his annual check up. Bob gave two numbers to try: with answering machine detection, your application could call Bob’s second line depending on if Bob’s answering machine or Bob himself answers the call. If it runs out of phone numbers, it could detect the final answering machine and leave a special message.

With text-to-speech and advanced speech recognition, you could integrate real time translations into your application. Imagine Alice doesn’t speak French but falls in love with Robert (Bob’s cousin) from Paris. She could speak in English, and using RELAY text-to-speech and speech recognition, it could play back her loving words in French. Or perhaps Alice wants to have a realtime transcription of what Robert is saying when they video chat, so she quickly puts together a RELAY video conference with an overlay so she can hear him but read the subtitles. RELAY truly may be the universal language of love!

You can even integrate RELAY into IoT hardware like smart appliances. Using RELAY, Bob’s fridge could automatically call customer service to set up a maintenance appointment if it detects a failure, or place an order for milk using an API from a gig-economy delivery company. You could even build your own smart doorbell with a Raspberry PI and a RELAY application. RELAY is simple and intuitive enough that we’re excited for users to think up new use cases of which we’ve never even dreamed!

Our Mission

What makes SignalWire special is that we’re never done innovating. While we are proud of RELAY, we will never stop improving it based on future technologies. We are constantly adding more features based on our user’s feedback and are always making our technology simpler for developers to use in order to democratize complex telecom. We’re bringing the most modern style of interfaces to an industry that has been historically very backwards and notoriously slow at evolving. We know what we’re doing is difficult, but we like difficult things. We are building the world’s best APIs for real time communications and will continue to simplify so that programmers can always just jump in and use our stuff.

With RELAY, you are getting an API that uses the most modern technologies available to be secure, global, and scalable by default. That’s the future as we see it.