Skip to main content

Basics of Relay

Relay is a cloud-based messaging service that helps developers build real-time features without managing servers. It uses a publish/subscribe (pub/sub) model, allowing teams to focus on their applications while Relay handles reliable and fast message delivery.

Real-Time Infrastructure

Fully Managed and Scalable

Relay runs in the cloud, so you don't have to set up or maintain your messaging infrastructure. It automatically scales to handle growing user numbers, high message volumes, and global demand, ensuring high availability and low latency. We aim to keep our p99 latencies under 100 ms.

Open-Source SDKs

Relay offers easy-to-use, open-source SDKs for various frontend and backend languages. These SDKs simplify integration, letting you publish and subscribe to messages with minimal code. Because they're open source, you can inspect and trust them.

Cross-Platform Support

Relay works seamlessly with both frontend (web, mobile) and backend (server) applications. Frontend developers can use Relay for features like notifications, chat, and collaboration, while backend developers can use it for service communication, pushing data to clients, and streaming IoT data from cyber-physical systems.

Focus on Your Product, Not Real-Time Plumbing

Relay removes the complexity of setting up real-time messaging infrastructure. You can build your application faster without worrying about the underlying systems like WebSockets or message brokers. This helps teams reduce development time and ongoing maintenance costs.


Publish/Subscribe (Pub/Sub)

Decoupled Communication

In the pub/sub model, publishers send messages to named topics, and subscribers receive messages from those topics. Relay acts as the broker, automatically delivering messages to subscribers. Publishers and subscribers remain independent, simplifying system design and scaling.

Real-Time Push Delivery

Relay instantly pushes messages to subscribers, ensuring very low latency. This approach eliminates the need for continuous polling, making it ideal for live interactive applications like dashboards, games, and notifications.

Asynchronous Messaging

Publishers use a simple "fire-and-forget" approach, sending messages without waiting for acknowledgments. Relay handles message delivery, ensuring high throughput and reducing complexity in your application's code.


Message Persistence and Reliability

Relay guarantees reliable message delivery by storing messages until they are successfully delivered.

  • Guaranteed Delivery (At-Least-Once): Relay ensures every message is delivered at least once, retrying automatically as needed.
  • Reliable Fire-and-Forget: Publishers simply send messages without additional logic—Relay handles delivery even if subscribers temporarily disconnect.
  • Reconnection Catch-up: Relay stores messages sent to subscribers who are actively trying to reconnect. When they come back online, they catch up on all missed messages during that downtime.
  • Offline Message Delivery: If messages were attempted to be delivered while the SDK was trying to reconnect, they are stored locally and resent upon successful reconnection. If the SDK does not reconnect within 2 minutes, it stops reconnection attempts, permanently closes the connection, and clears any undelivered messages from the queue.
  • Message History: Developers can retrieve past messages using Relay’s history APIs, which is useful for chat histories or debugging. Message retention duration is based on your service plan tier.
  • Robust Reliability: Relay maintains high reliability during network outages, server restarts, or client disconnections, ensuring messages are never lost.

Relay’s pub/sub system combined with persistent storage ensures your real-time applications are reliable, scalable, and easy to maintain.


Upcoming Features

  • Queue Support: We're working on adding support for queues, which will allow messages to be processed by a single subscriber at a time. This is ideal for task distribution, background processing, and load balancing use cases.