💾 Storage System Guide
Learn how XHub Chat stores and manages data.
Overview
XHub Chat provides a flexible storage system with multiple backends:
- IndexedDB - Persistent browser storage (recommended)
- Memory - In-memory storage (Node.js, testing)
Using IndexedDB
import { createClient } from '@xhub-chat/core';
const client = createClient({
baseUrl: 'https://server.com',
accessToken: 'token',
userId: '@user:server.com',
store: {
type: 'indexeddb',
dbName: 'my-chat-app',
workerApi: true, // Use Web Worker
},
});
Using Memory Store
const client = createClient({
// ... config
store: {
type: 'memory',
},
});