How It Works
SuperDoc uses Yjs, a CRDT (Conflict-free Replicated Data Type) library, to enable real-time collaboration. Changes are synchronized through WebSocket connections to ensure all users see the same document state.Real-time Sync
Changes appear instantly for all connected users
Conflict Resolution
CRDTs automatically merge concurrent edits
Offline Support
Continue editing offline, sync when reconnected
User Awareness
See who’s online with cursors and selections
Quick Start
Need a backend? See our collaboration backend guide
Configuration
Collaboration module configuration
Required Settings
WebSocket server URL
Authentication
Authentication token
Optional if using cookie-based auth on same domain
Additional connection parameters
Provider Type
Provider implementation
User Configuration
Each user must have identifying information:Current user information
User Presence & Awareness
Showing Active Users
Map of user states with their information
User Colors
Each user automatically gets a unique color from the palette:Color palette for user awareness
Events
Connection Events
Awareness Events
Authentication Strategies
- JWT Token
- API Key
Multiple Documents
For multiple collaborative documents in one SuperDoc:Common Patterns
Connection Monitoring
Handling Auth Failures
Offline Support
Performance Tips
For optimal performance:
- Limit active users per document (recommended: < 50)
- Use debounced saves (2-5 seconds)
- Enable compression for WebSocket
- Monitor bandwidth usage
Troubleshooting
Connection Issues
WebSocket won't connect
WebSocket won't connect
Check:
- Correct protocol (
ws://
for local,wss://
for production) - CORS settings on server
- Firewall/proxy configuration
- Authentication token validity
Changes not syncing
Changes not syncing
Verify:
- Both users in same document/room
- Server receiving updates (check logs)
- No network throttling
- Document IDs match
High latency
High latency
Consider:
- Server location (use CDN/edge)
- Message size (batch updates)
- Connection quality
- Number of concurrent users
Security Considerations
Always implement:
- Server-side authentication
- Document access validation
- Rate limiting
- WSS (encrypted WebSocket) in production
- Input sanitization