Real-time Sync
CloudSync's real-time sync engine ensures your files are always up-to-date across all devices, with changes propagating in milliseconds.
How It Works
Our sync engine uses a combination of technologies to achieve near-instant synchronization:
- WebSocket Connections - Persistent connections for instant updates
- Delta Sync - Only changed bytes are transferred
- Content-Addressable Storage - Deduplication at the block level
- Operational Transformation - Conflict-free collaborative editing
Sync Modes
Real-time Mode (Default)
Files sync instantly as changes are detected. Best for:
- Active collaboration
- Small to medium files
- Documents and code
Scheduled Mode
Files sync at configured intervals. Best for:
- Large files
- Bandwidth-limited connections
- Backup scenarios
Manual Mode
Files only sync when explicitly triggered. Best for:
- Sensitive operations
- Testing and development
Configuration
CLI Configuration
bash
# Set sync mode
cloudsync config set sync.mode realtime
# Set conflict resolution
cloudsync config set sync.conflicts auto-mergeSDK Configuration
typescript
const client = new CloudSync({
apiKey: process.env.CLOUDSYNC_API_KEY,
sync: {
mode: 'realtime',
conflictResolution: 'auto-merge',
deltaSync: true
}
})Monitoring Sync Status
Status Command
bash
cloudsync statusOutput:
Workspace: My Project
Status: Syncing
Progress: 42/50 files
Speed: 2.3 MB/s
Last sync: 3 seconds agoSync Events
Subscribe to sync events in your application:
typescript
client.on('sync:start', (event) => {
console.log(`Syncing ${event.files.length} files`)
})
client.on('sync:complete', (event) => {
console.log(`Sync complete in ${event.duration}ms`)
})
client.on('sync:error', (error) => {
console.error('Sync failed:', error.message)
})Troubleshooting
Common Issues
Files not syncing
- Check your internet connection
- Verify you're signed in:
cloudsync whoami - Check sync status:
cloudsync status - Review logs:
cloudsync logs
Slow sync speeds
- Check network bandwidth
- Try switching to delta sync mode
- Exclude large binary files with filters
- Contact support for large-scale deployments