Core Concepts

Check for Update Strategy

Last updated by Harlan Wilton in doc: internal links.

When a new version of your Nuxt app is deployed we need to notify active users of the new version. Out of the box, Nuxt applies a polling strategy, checking every hour if the build is out of date.

Alternative strategies like Server-Sent Events (SSE), WebSockets, and external providers provide real-time notifications, but have different platform compatibilities and performance trade-offs.

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.

Bot traffic is automatically excluded from connections when @nuxtjs/robots is installed. See Bot Traffic Filtering.

See the Performance Guide for more details.

Platform Defaults

The best strategy is automatically selected based on your deployment platform, but you can override it in your configuration using updateStrategy.

ProviderupdateStrategy
Node.jssse
Bunsse
Denosse
Vercelsse
Cloudflare Workerspolling
Cloudflare Durablews
Netlifysse
Static/Prerenderedpolling or 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.

Update checkOutdatedBuildInterval to a quicker polling interval—1 hour is too slow for most applications.

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.

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

WebSocket

Real-time updates using WebSockets. These are mostly useless as SSE is more performant however 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 allow you to use external WebSocket providers for real-time update notifications. This is ideal for static/prerendered sites or when you want to offload connection management to a third-party service.

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.

Did this page help you?