SSE and WebSocket strategies maintain persistent connections to your server. For small to medium applications (under 10,000 concurrent users), this is typically fine—modern servers handle thousands of idle connections efficiently.
For high-traffic applications (10,000+ concurrent users), use an Adapter with Ably or Pusher. These services are built for millions of concurrent connections and include automatic reconnection, global edge distribution, and connection multiplexing.
Connections are not established until <SkewNotification> or useSkewProtection() is used. The plugin only sets up infrastructure—actual SSE/WebSocket connections happen when a component using skew protection mounts.
This means you can control exactly when connections are created by placing <SkewNotification> only on specific pages.
disconnect() if you need to close it manually.Add <SkewNotification> or useSkewProtection() only where needed:
<script setup lang="ts">
const skew = useSkewProtection()
skew.onAppOutdated(() => {
// handle update
})
</script>
<template>
<div>
<SkewNotification v-slot="{ isAppOutdated, reload }">
<button v-if="isAppOutdated" @click="reload">
Update available
</button>
</SkewNotification>
<!-- page content -->
</div>
</template>
Use route middleware or conditional rendering for more control:
<script setup lang="ts">
const route = useRoute()
const protectedRoutes = ['/dashboard', '/admin', '/settings']
const shouldProtect = computed(() =>
protectedRoutes.some(r => route.path.startsWith(r))
)
</script>
<template>
<div>
<SkewNotification v-if="shouldProtect" v-slot="{ isAppOutdated, reload }">
<button v-if="isAppOutdated" @click="reload">
Update available
</button>
</SkewNotification>
<slot />
</div>
</template>
This reduces active connections to only users on protected routes.
For fine-grained control, use lazy: true to prevent auto-connect and manually control when connections are established:
<script setup lang="ts">
const skew = useSkewProtection({ lazy: true })
// Only connect after user starts checkout
function startCheckout() {
skew.connect()
// proceed with checkout...
}
// Disconnect when done
onBeforeRouteLeave(() => {
skew.disconnect()
})
</script>
This is useful when you want connections only during specific user flows rather than entire pages.
Bot and crawler traffic is automatically excluded from SSE/WebSocket connections when @nuxtjs/robots is installed. This prevents bots from inflating connection counts and wasting server resources.
Install @nuxtjs/robots as a peer dependency:
npx nuxi module add @nuxtjs/robots
The module uses useBotDetection() from @nuxtjs/robots to detect bot user agents (Googlebot, Bingbot, etc.) and skip establishing real-time connections for them.
When a bot visits your site:
useBotDetection() identifies the bot via user agentuseActiveConnections() statsThis is automatic—no configuration needed beyond installing @nuxtjs/robots.