Skip to main content

Real Time Block

Real Time Block

WebSockets and WebRTC

The Real Time Block enables real-time communication. Build chat applications, live updates, video calls, and collaborative features with WebSocket and WebRTC support.

Features

  • WebSocket connections
  • Real-time messaging
  • Presence tracking
  • Channels and rooms
  • WebRTC video/audio
  • Live updates
  • Broadcast events

Quick Start

npm install @23blocks/sdk
import { BlocksClient } from '@23blocks/sdk';

const client = new BlocksClient({
baseUrl: 'https://api.23blocks.com',
appId: 'your-app-id'
});

// Connect to real-time
const realtime = client.realtime.connect();

// Subscribe to a channel
realtime.subscribe('chat-room-1', (message) => {
console.log('New message:', message);
});

// Send a message
realtime.send('chat-room-1', {
text: 'Hello, world!'
});