Skip to main content

ChatSDK Documentation

A modern, real-time chat SDK for building messaging features into your applications.

Quick Start

Installation

# Core SDK
npm install @chatsdk/core

# React Components
npm install @chatsdk/react

# React Native
npm install @chatsdk/react-native

Basic Setup

import { createChatClient } from '@chatsdk/core';

const client = createChatClient({
apiUrl: 'https://your-api-server.com',
tokenProvider: async (user) => {
const response = await fetch('/api/chat-token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ userId: user?.id }),
});
return response.json();
},
});

// Connect a user
await client.connectUser({ id: 'user-123', name: 'Alice' });

// Query channels
const channels = await client.queryChannels();

// Send a message
await client.sendMessage('channel-id', { text: 'Hello!' });

Features

  • Real-time messaging - WebSocket-based with Centrifugo
  • Offline support - Messages queue when offline, sync when online
  • Sequence-based sync - Gap detection and automatic recovery
  • Rich messages - Text, images, files, voice notes
  • Reactions - Emoji reactions with real-time updates
  • Typing indicators - See when users are typing
  • Read receipts - Delivered and read status
  • Mentions - @user mentions with notifications
  • Threads - Reply to messages in threads
  • Search - Full-text message search

Packages

PackageDescription
@chatsdk/coreCore SDK with sync engine
@chatsdk/reactReact hooks and components
@chatsdk/react-nativeReact Native components
iOS SDKNative Swift SDK

Guides

Examples