Storage and Broadcast
The RealtimeKit Stores API allows you to create multiple key-value pair realtime stores. Users can subscribe to changes in a store and receive real-time updates. Data is stored until a session is active.
You can create a realtime store (changes are synced with other users):
| Param | Type | Description | Required |
|---|---|---|---|
name | string | Name of the store | true |
To create a store:
const stores = useRealtimeKitSelector((m) => m.stores);const store = stores.create('myStore');const store = meeting.stores.create('myStore');const store = meeting.stores.create('myStore');You can add, update or delete entires in a store:
| Param | Type | Description | Required |
|---|---|---|---|
key | string | Unique identifier used to store/update a value in the store | Yes |
value | StoreValue | Value that can be stored agains a key | Yes |
type StoreValue = string | number | object | array;const stores = useRealtimeKitSelector((m) => m.stores.stores);const store = stores.get("myStore");
await store.set("user", { name: "John Doe" });
await store.update("user", { age: 34 }); // { name: 'John Doe', age: 34 }
await store.delete("user");type StoreValue = string | number | object | array;const { stores } = meeting.stores;const store = stores.get("myStore");
await store.set("user", { name: "John Doe" });
await store.update("user", { age: 34 }); // { name: 'John Doe', age: 34 }
await store.delete("user");type StoreValue = string | number | object | array;const { stores } = meeting.stores;const store = stores.get("myStore");
await store.set("user", { name: "John Doe" });
await store.update("user", { age: 34 }); // { name: 'John Doe', age: 34 }
await store.delete("user");You can attach event listeners on a store's key, which fire when the value changes.
const stores = useRealtimeKitSelector((m) => m.stores.stores);const store = stores.get('myStore');store.subscribe('key', (data) => { console.log(data);});
// subscribe to all keys of a storestore.subscribe('\*', (data) => {console.log(data);});
store.unsubscribe('key');const { stores } = meeting.stores;const store = stores.get('myStore');store.subscribe('key', (data) => { console.log(data);});
// subscribe to all keys of a storestore.subscribe('\*', (data) => {console.log(data);});
store.unsubscribe('key');const { stores } = meeting.stores;const store = stores.get('myStore');store.subscribe('key', (data) => { console.log(data);});
// subscribe to all keys of a storestore.subscribe('\*', (data) => {console.log(data);});
store.unsubscribe('key');You can fetch the data stored in the store:
const stores = useRealtimeKitSelector((m) => m.stores.stores);const store = stores.get('myStore');
// fetch value for a specific keyconst data = store.get('key');
// fetch all the data in the storeconst data = store.getAll();const { stores } = meeting.stores;const store = stores.get('myStore');
// fetch value for a specific keyconst data = store.get('key');
// fetch all the data in the storeconst data = store.getAll();const { stores } = meeting.stores;const store = stores.get('myStore');
// fetch value for a specific keyconst data = store.get('key');
// fetch all the data in the storeconst data = store.getAll();Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2026 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark
-