NuxtN
Nuxt2mo ago
7 replies
Tio

Websockets with NuxtHub and Cloudflare Workers

Hello,

I am using Nuxt 4 with the new NuxtHub update. I am using Cloudflare Workers. In the docs, there is a realtime section that I followed. But when I deploy it, the websockets doesn't seems to work correctly. It keeps getting on "Visitors: 1" in my visitors page and when I open another tab, it stays to 1. If I refresh several times, sometimes, the visitor is counted, so 2.

nitro.config.ts
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2025-07-15',
  devtools: { enabled: true },
  modules: ['@nuxthub/core-nightly', '@vueuse/nuxt'],
  nitro: {
    experimental: {
      websocket: true
    },
    preset: "cloudflare_module"
  }
})


I know that in the docs it's mentionned to use the preset "cloudflare_durable", but the result is the same.

The docs: https://hub.nuxt.com/docs/guides/realtime

Thanks for help in advance.
NuxtHub
Build real-time experiences with NuxtHub.
Realtime & WebSockets · NuxtHub
Was this page helpful?