Overview
TheInLiveClient provides real-time communication capabilities through WebSocket connections. It enables your application to receive instant updates when entries or settings change on the server, without polling.
Key Features
- Entry Subscriptions: Listen to changes on specific entries
- Entry Type Subscriptions: Monitor all entries of a given type
- Settings Subscriptions: Track settings updates in real-time
- Connection Management: Automatic reconnection and status monitoring
- Room-based Architecture: Efficient event distribution through rooms
Creating a Live Client
Connection Management
Starting the Connection
Stopping the Connection
Monitoring Connection Status
Track the connection status to update your UI:Entry Subscriptions
Subscribe to changes on specific entries by their type and ID.Listening to Entry Events
Removing Entry Listeners
Entry Type Subscriptions
Monitor all entries of a specific type to receive events whenever any entry of that type is created, updated, or deleted.Listening to Entry Type Events
Removing Entry Type Listeners
Settings Subscriptions
Subscribe to settings changes to keep your application configuration in sync.Listening to Settings Events
Removing Settings Listeners
Custom Room Management
For advanced use cases, you can join and leave custom rooms:Event Types
Entry Events
- update: Entry data has changed
- delete: Entry has been deleted
- create: New entry has been created (entry type subscriptions only)
- join: Successfully joined the entry room
- leave: Left the entry room
Settings Events
- update: Settings data has changed
- join: Successfully joined the settings room
- leave: Left the settings room
Connection Status
- connecting: Initial connection attempt
- open: Connection established
- reconnected: Connection re-established after disconnect
- closed: Connection closed
- error: Connection error occurred
Automatic Room Management
The client automatically manages room subscriptions:- When you add the first listener for an entry/type/settings, the client joins the corresponding room
- When you remove the last listener, the client automatically leaves the room
- This ensures efficient resource usage and prevents unnecessary network traffic
Best Practices
Named Listeners
Always use unique, descriptive names for listeners to easily manage and remove them later.
Cleanup
Remove listeners when components unmount to prevent memory leaks and unnecessary event handling.
Connection Status
Monitor connection status to provide feedback to users and handle reconnection scenarios.
Type Safety
Use TypeScript interfaces for your data types to ensure type-safe event handling.
Real-World Example
Next Steps
Cloud Client
Learn about the main API client
Entries
Understand the Entry system
Settings
Explore the Settings system
Integration Guide
Build real-time features