Skip to content

Backend

Supabase Realtime Channels — How Velocity X Pushes Live Updates to Reps Without Polling

WebSocket channels, presence tracking, and the patterns that keep dashboards live

📡 📊

Polling is the enemy of real-time ops. Ask a database every 3 seconds "did anyone close a deal?" and you've burned 28,800 queries a day per user. At 50 reps, that's 1.44 million polls while the leaderboard sits stale. Supabase Realtime fixes this by streaming Postgres changes directly to clients over WebSocket. A deal closes at 14:32:15; the rep sees it at 14:32:16. No polling. No artificial delay. Sub-2-second latency, end-to-end.

The Architecture (Replication Slots → WebSocket Push)

When you insert a row into the deals table, Postgres fires a trigger. Write-ahead log entries stream via logical replication. Supabase's Realtime server listens on that stream, re-applies RLS policies (so reps only see their org's data), and broadcasts to subscribed clients. You subscribe by table or broadcast topic; every INSERT/UPDATE/DELETE fires an event containing the full row and operation type. This is built into Supabase—no extra setup required. Just enable Realtime, subscribe to a channel, and handle the listener callback.

Three Patterns in Practice

Table changes work best for live updates: rep A closes a deal, rep B's leaderboard rank drops immediately. Presence tracking (who's online, who's editing) costs almost nothing. Broadcast is for server-side-computed events like leaderboard recalculations. Velocity X uses all three: table subscriptions for deal state, presence for "who's active", broadcast for the aggregated leaderboard sent down from an Edge Function after each close.

{`// Subscribe to deals, upsert into local state
supabase
  .channel('public:deals')
  .on('postgres_changes', { event: '*', table: 'deals' }, (payload) => {
    const { eventType, new: deal } = payload;
    if (eventType === 'INSERT' || eventType === 'UPDATE') {
      setDeals((d) => {
        const idx = d.findIndex((x) => x.id === deal.id);
        return idx >= 0 ? [...d.slice(0, idx), deal, ...d.slice(idx + 1)] : [...d, deal];
      });
    }
  })
  .subscribe();`}

The Catch: Reconnection & Replay

WebSocket drops are inevitable. When the connection dies, Realtime doesn't queue missed events—it's a stream, not a queue. On reconnect, re-fetch fresh data and merge with local mutations. For critical dashboards (leaderboards, quotas), run a 30-second heartbeat check to catch drift. Most teams add a "stale" badge on disconnect and refresh on reconnect.

Quick FAQs

Does it apply RLS? Yes—the server re-evaluates policies before broadcasting. Latency? 500ms–2s typically; varies with network hops. Scale? Supabase allows ~4 channels per client by default. Filtering? Subscribe with filter: 'closer_id=eq.123' to reduce noise. Large payloads? Send only the row ID from Realtime; fetch the full object on demand.

The Verdict

Realtime is table stakes for sales-motion SaaS. Dashboards that feel alive—leaderboards updating in real-time, quota tiles moving as deals close—ship faster and convert harder. Polling can't deliver this without melting your database. Supabase Realtime does it with WebSocket push, RLS out of the box, and presence tracking. The setup is 10 lines of code. The ROI is a team that no longer squints at stale dashboards. See it live in Velocity X's dashboard. For pricing and feature details, check our tier breakdown.

Let us make some quick suggestions?

Please provide your full name.
Please provide your phone number.
Please provide a valid phone number.
Please provide your email address.
Please provide a valid email address.
Please provide your brand name or website.
Please provide your brand name or website.