Back to blog

Real-Time Data Sync Across Devices

Deep dive into how Widgets PRO keeps your dashboards in sync across all platforms with WebSocket subscriptions.

Widgets PRO Team··8 min read
engineeringarchitecture

When you update a widget on your phone, the change appears on your TV dashboard instantly. Here’s how we built our real-time sync engine.

Architecture Overview

Widgets PRO uses a pub/sub architecture built on WebSocket connections with GraphQL subscriptions. Every device maintains a persistent connection to our sync layer.

Client A (Web) ──┐
Client B (iOS) ──┤── WebSocket ──► Sync Layer ──► PostgreSQL
Client C (TV)  ──┘

How It Works

  1. Connection — each client establishes a WebSocket connection on app launch
  2. Subscription — clients subscribe to dashboards they’re viewing
  3. Mutation — when data changes, the sync layer broadcasts to all subscribers
  4. Reconciliation — clients merge updates with local state using last-write-wins

Handling Offline

Mobile devices often lose connectivity. Our sync engine handles this gracefully:

  • Optimistic updates — changes apply locally before server confirmation
  • Queue — offline mutations are queued and replayed on reconnect
  • Conflict resolution — timestamp-based LWW with optional manual merge

Performance

We keep sync latency under 100ms for 95th percentile:

MetricTargetActual
Sync latency (p50)< 50ms32ms
Sync latency (p95)< 100ms78ms
Reconnection time< 2s1.2s
Max concurrent connections10,00012,400

What’s Next

We’re working on CRDT-based conflict resolution for collaborative editing of dashboard layouts. This will allow multiple team members to edit the same dashboard simultaneously without conflicts.

Share this article