Index of every page on this site: llms.txt

Check for Update Strategy

Update detection tells active users about a new deployment. Nuxt uses polling by default, checking once an hour.

Server-Sent Events (SSE), WebSockets, and external providers send updates in real time. Each has different hosting requirements.

StrategyReal-timePlatformsServer LoadClient Connections
Polling❌ Delayed✅ All✅ Minimal✅ None
SSE✅ Instant⚠️ Node.js/Bun/Deno⚠️ Low⚠️ Persistent
WebSocket✅ Instant⚠️ Cloudflare Durable⚠️ Moderate⚠️ Persistent
Adapter✅ Instant✅ All (incl. Static)✅ None (external)✅ External provider

Performance Considerations

SSE and WebSocket strategies maintain persistent connections on your server. For high-traffic applications (10,000+ concurrent users), using an Adapter with external providers like Ably or Pusher may be worthwhile.

The module automatically excludes bot traffic from connections when you install @nuxtjs/robots. See Bot Traffic Filtering.

See the Performance Guide for more details.

Platform Defaults

Every platform uses Nuxt's native polling by default. No persistent update connection opens.

For immediate updates, set updateStrategy: 'sse' on supported servers. For Cloudflare Durable Objects, set updateStrategy: 'ws' and enable Nitro WebSockets. Static sites can opt into an adapter.

Note: For ws strategy, you must enable nuxt.options.nitro.experimental.websocket.

Polling

The default strategy that works on all platforms. Uses Nuxt's built-in experimental.checkOutdatedBuildInterval to periodically fetch builds/latest.json to determine if a new deployment has occurred.

The default interval is one hour. The module preserves your interval and adds no polling timer. The module requires experimental.appManifest. If you disable it, enable it or disable the module. If experimental.checkOutdatedBuildInterval is false, Nuxt stops native polling. Enable the interval or opt into a supported push strategy to detect updates.

For faster detection, shorten checkOutdatedBuildInterval. This example checks every five minutes:

nuxt.config.ts
export default defineNuxtConfig({
  skewProtection: {
    updateStrategy: 'polling'
  },
  experimental: {
    checkOutdatedBuildInterval: 5 * 60 * 1000 // 5 minutes
  }
})

SSE

Real-time updates using Server-Sent Events. SSE does keep persistent connections open. Be mindful of this if you have a high-traffic site. SSE has less overhead than WebSockets.

With multiTab: true, tabs share one push connection through Web Locks and BroadcastChannel. Closing or hiding the owner transfers the connection to a waiting visible tab. Hidden tabs release ownership and do not request a connection. Showing or restoring a tab resumes its requested subscription. Explicit disconnect keeps it paused. Browsers without either API keep independent connections. With connectionTracking: true, connections remain separate for per-tab routes and statistics. Set multiTab: false to keep separate connections explicitly.

The same ownership rules apply to WebSockets and external adapters. Visible subscribed tabs share server version messages, without connection identifiers. Connection identifiers, statistics, and other transport messages belong to the owner tab. All tabs receive complete manifest updates through onAppOutdated(). Send operations act only on the owner's transport. For independent commands, disable multi-tab sharing or enable connection tracking.

nuxt.config.ts
export default defineNuxtConfig({
  skewProtection: {
    updateStrategy: 'sse'
  }
})

WebSocket

Real-time updates using WebSockets. SSE is generally more efficient, but for certain conditions like using Cloudflare Workers and some proxying services, WebSockets may be the best option.

Cloudflare Durable Objects
export default defineNuxtConfig({
  nitro: {
    preset: 'cloudflare-durable',
    experimental: {
      websocket: true
    }
  },
  skewProtection: {
    updateStrategy: 'ws'
  }
})

Adapter

Adapters use external WebSocket providers for real-time update notifications, including on static/prerendered sites. The provider manages connections.

Available adapters:

nuxt.config.ts
import { pusherAdapter } from 'nuxt-skew-protection/adapters/pusher'

export default defineNuxtConfig({
  skewProtection: {
    updateStrategy: pusherAdapter({
      key: process.env.PUSHER_KEY,
      cluster: process.env.PUSHER_CLUSTER,
      appId: process.env.PUSHER_APP_ID,
      secret: process.env.PUSHER_SECRET,
    })
  }
})

See External Providers for detailed setup guides.

Was this page helpful?