Documentation

Complete API reference, tutorials, and guides to get you started

Quick Start

Get API Keys

Sign up and get your API keys in seconds. No credit card required.

Get Started

Choose Your SDK

Pick your favorite language - JavaScript, Python, Java, Go, and more.

View SDKs

Send Your First Message

Follow our 5-minute tutorial to send your first real-time message.

Start Tutorial

Popular Code Examples

JavaScript

import Relay from 'relay-js';

const hub = new Relay({
  apiKey: 'your-api-key'
});

// Subscribe to messages
hub.subscribe('chat', (message) => {
  console.log('Message:', message);
});

// Publish a message
hub.publish('chat', {
  text: 'Hello, World!',
  timestamp: Date.now()
});

Python

from relay import Relay

hub = Relay(api_key='your-api-key')

# Subscribe to messages
def on_message(message):
    print(f"Message: {message}")

hub.subscribe('chat', on_message)

# Publish a message
hub.publish('chat', {
    'text': 'Hello, World!',
    'timestamp': time.time()
})

React

import { useRelay } from 'relay-react';

export function Chat() {
  const { messages, publish } = 
    useRelay('chat');

  return (
    <div>
      {messages.map((msg) => (
        <div key={msg.id}>{msg.text}</div>
      ))}
      <button onClick={() => publish({
        text: 'Hello'
      })}>
        Send
      </button>
    </div>
  );
}

Go

package main

import "relay-go"

func main() {
  hub := relay.New(
    "your-api-key")
  
  // Subscribe
  hub.Subscribe("chat", 
    func(msg Message) {
      println(msg.Text)
    })
  
  // Publish
  hub.Publish("chat", Message{
    Text: "Hello, World!",
  })
}

Need Help?

Our support team is here to help. Check our FAQ, community forum, or contact support.