Skip to content

Introduction

Realtime Pub/Sub is a cutting-edge SaaS solution that supercharges your applications with:

  • ⚡️ Real-time Publish/Subscribe capabilities
  • 🔌 Seamless and Secure WebSocket integration
  • 🌐 Scalable real-time infrastructure

Centralized Management
Listen to our Introduction to Realtime Pub/Sub podcast (powered by AI)

Get started today:

Open Admin Console

const {RealtimeClient} = require('realtime-pubsub-client')

const APP_ID = 'YOUR APP ID HERE'
const CLUSTER_HOST = 'genesis.r7.21no.de'

// verifiable via "app/configuration/authKey"
const ACCESS_TOKEN = 'VALID JWT TOKEN HERE' 

const client = new RealtimeClient({
  websocketOptions: {
    // https://www.npmjs.com/package/reconnecting-websocket#available-options
    urlProvider: async () => {
      return `wss://${CLUSTER_HOST}/apps/${APP_ID}?access_token=${ACCESS_TOKEN}`
    },
  }
})

client.on('session.started', (info) => {
  client
    .subscribeRemoteTopic('topic1')
    .subscribeRemoteTopic('topic2')
  // ...

  console.log('> Up and listening!')
})

client.on('main.hello-echo', (message) => {
  console.log('> Received hello-echo message:', message)
})

client.connect()
const {RealtimeClient} = require('realtime-pubsub-client')

const APP_ID = 'YOUR APP ID HERE'
const CLUSTER_HOST = 'genesis.r7.21no.de'

// verifiable via "app/configuration/authKey"
const ACCESS_TOKEN = 'VALID JWT TOKEN HERE' 

const client = new RealtimeClient({
  websocketOptions: {
    // https://www.npmjs.com/package/reconnecting-websocket#available-options
    urlProvider: async () => {
      return `wss://${CLUSTER_HOST}/apps/${APP_ID}?access_token=${ACCESS_TOKEN}`
    },
  }
})

client.on('session.started', (info) => {
  console.log('> Connected: ', info)

  setInterval(() => {
    // Publish 'hello-echo' message on the 'main' topic
    console.log('> Sending message...')

    client.publish('main', {
      text: 'Greetings, fellow "sockets"!'
    }, {
      messageType: 'hello-echo'
    })
  }, 1000)
})

client.connect()

The realtime:publisher:write:topic:main permission is required to be present in the JWT token to publish messages to the main topic.

const APP_ID = 'YOUR_APP_ID'

// verifiable via "app/configuration/adminKey"
const AUTH_TOKEN = 'Bearer AUTH_TOKEN_HERE' 

const reqHeaders = new Headers()
reqHeaders.append('Accept', 'application/json')
reqHeaders.append('Content-Type', 'application/json')
reqHeaders.append('Authorization', AUTH_TOKEN)

fetch(`https://genesis.r7.21no.de/api/topics/${APP_ID}/publish`, {
  method: 'POST',
  headers: reqHeaders,
  body: JSON.stringify({
    topic: 'main',
    messageType: 'greeting',
    message: 'Hello subscribers in main topic 👋'
  })
})
  .then(() => console.log('Message published!'))
  .catch(console.error)

The realtime:publisher:write:topic:main permission is required to be present in the JWT token to publish messages to the main topic.

Checkout more ready to use Node.js snippets: https://github.com/BackendStack21/realtime-forum/tree/main/demos/node

Use cases

Realtime Pub/Sub is ideal for workflows where the clients and servers have to exchange instant messages. The following categories are great use-cases:

  • Low-latency and energy-efficient communication (like multiplayer games or communicating with IoT devices)
  • Sending messages to servers (like chat apps or IoT devices sharing sensor info)
  • Delivering messages to clients (like UI alerts or commands to IoT gadgets)
  • Live dashboards (like stock market graphs)
  • Multimedia uses (like messaging, games, or team projects)

Main features

Our core uses and support projects of the 21no.de organization. By using Realtime Pub/Sub, you are also supporting the development and maintenance of open-source projects 💚

Enable real-time capabilities anywhere

Our platform empowers you to effortlessly incorporate WebSocket-based real-time Pub/Sub capabilities into your applications, no matter where or when you need them. Using our high-performance APIs, you can seamlessly publish messages into your application topics, ensuring that your users receive them instantly.
By enabling inbound WebSocket-based communication, your application clients can efficiently deliver instant messages to backend services.

High performance at scale

Realtime Pub/Sub enables lightning-fast communication with our low-latency messaging solution. Under the hood, you will find Node.js, uWebSockets.js and Redis powering optimal WebSocket performance for your users.
Our infrastructure is built to manage heavy traffic smoothly and scale to meet growing demands efficiently.

Open WebSocket Roundtrip Latency Benchmarker

Read more: World Capitals Latency Benchmark ⚡🚀

Standard Web Protocols

Realtime Pub/Sub leverages the well-established WebSocket protocol for real-time communication, eliminating the need for proprietary or custom interfaces. By utilizing standard implementations, you can be confident in the reliability and compatibility of our solution.
Additionally, publishers and administrators/operators can communicate with our platform through a simple and easy-to-use REST API, providing a seamless experience for any runtime.

Secure by design

Our platform ensures secure communication with the latest in encryption technology, utilizing secure TLS(1.2 and 1.3) implementations all ingress endpoints, making sure that data transmitted between internet clients and our servers is safeguarded during transit.
Furthermore, we mandate JSON Web Token (JWT) authentication for all communication endpoints, adding an additional layer of security. This strategy also embraces Public Key Cryptography, facilitating zero trust authentication to enhance overall security measures.

We take the heavy lifting off your shoulders

Managing and scaling long-living TCP connections at scale can be complex and challenging due to several factors, including:

  • Resource management: Managing the resources required to handle a large number of simultaneous connections can be a challenge. As the number of connections increases, the memory, CPU, and network bandwidth required to maintain the connections also increases.
  • Network latency: As the number of connections grows, the network latency can become a bottleneck. This can result in slow data transfer rates and decreased performance, making it difficult to maintain real-time functionality.
  • Resilience and failure handling: In a high-scale system, failures can happen at any time. It's important to have a robust architecture in place to handle such failures and minimize downtime.
  • Load balancing: In a system that processes that many connections and messages, it's important to balance the load between multiple servers to avoid overloading any single server. This can be a complex process, especially in real-time systems where the load can change rapidly.
  • Security and Isolation: Ensuring data security and isolation is critical in real-time systems. Without proper measures, data breaches and unauthorized access can occur. Isolation between connections is vital to prevent interference.

Realtime Pub/Sub takes care of all these challenges for you, providing a reliable and scalable platform for real-time communication.

Administration in one place

Applications management and analytics is available through our administration console: https://admin.r7.21no.de:

Centralized Management

Building beyond our console?

Through our REST APIs, you have the ability to create custom monitoring solutions tailored to your specific needs. Whether you need to monitor usage, or track volume and costs, our APIs provide the foundation for you to build the solution you require.

Read more: API Docs and Accessing Application Telemetry via REST

Deploy on your infrastructure

If you are interested in hosting and managing the Realtime Pub/Sub on your own infrastructure, please contact us at realtime.contact@21no.de

Community

Follow and engage in community discussions at: https://github.com/BackendStack21/realtime-forum