[{"data":1,"prerenderedAt":758},["ShallowReactive",2],{"navigation":3,"\u002Fblog\u002Fversion-2-1":116,"\u002Fblog\u002Fversion-2-1-surround":747},[4,43,82,102,109],{"title":5,"path":6,"stem":7,"children":8,"icon":42},"Getting Started","\u002Fgetting-started","1.getting-started\u002F1.index",[9,12,17,22,27,32,37],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-house",{"title":13,"path":14,"stem":15,"icon":16},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Configuration","\u002Fgetting-started\u002Fconfiguration","1.getting-started\u002F3.configuration","i-lucide-settings",{"title":23,"path":24,"stem":25,"icon":26},"Usage","\u002Fgetting-started\u002Fusage","1.getting-started\u002F4.usage","i-lucide-code",{"title":28,"path":29,"stem":30,"icon":31},"Authentication","\u002Fgetting-started\u002Fauthentication","1.getting-started\u002F5.authentication","i-lucide-lock",{"title":33,"path":34,"stem":35,"icon":36},"Securing your app","\u002Fgetting-started\u002Fsecuring-your-app","1.getting-started\u002F6.securing-your-app","i-lucide-shield-check",{"title":38,"path":39,"stem":40,"icon":41},"DevTools","\u002Fgetting-started\u002Fdevtools","1.getting-started\u002F7.devtools","i-lucide-radio-tower",false,{"title":44,"icon":26,"path":45,"stem":46,"children":47,"page":42},"Composables","\u002Fcomposables","2.composables",[48,53,58,63,68,72,77],{"title":49,"path":50,"stem":51,"icon":52},"useRealtimeState","\u002Fcomposables\u002Fuserealtimestate","2.composables\u002F1.useRealtimeState","i-lucide-refresh-cw",{"title":54,"path":55,"stem":56,"icon":57},"useRealtimeEvents","\u002Fcomposables\u002Fuserealtimeevents","2.composables\u002F2.useRealtimeEvents","i-lucide-radio",{"title":59,"path":60,"stem":61,"icon":62},"useRealtimeConnection","\u002Fcomposables\u002Fuserealtimeconnection","2.composables\u002F3.useRealtimeConnection","i-lucide-wifi",{"title":64,"path":65,"stem":66,"icon":67},"useRealtimePresence","\u002Fcomposables\u002Fuserealtimepresence","2.composables\u002F4.useRealtimePresence","i-lucide-users",{"title":69,"path":70,"stem":71,"icon":31},"useRealtimeLock","\u002Fcomposables\u002Fuserealtimelock","2.composables\u002F5.useRealtimeLock",{"title":73,"path":74,"stem":75,"icon":76},"useRealtimeLockRoom","\u002Fcomposables\u002Fuserealtimelockroom","2.composables\u002F6.useRealtimeLockRoom","i-lucide-list-checks",{"title":78,"path":79,"stem":80,"icon":81},"useRealtimeRoom","\u002Fcomposables\u002Fuserealtimeroom","2.composables\u002F7.useRealtimeRoom","i-lucide-door-open",{"title":83,"icon":84,"path":85,"stem":86,"children":87,"page":42},"Technical","i-lucide-cpu","\u002Ftechnical","3.technical",[88,93,97],{"title":89,"path":90,"stem":91,"icon":92},"Architecture","\u002Ftechnical\u002Farchitecture","3.technical\u002F1.architecture","i-lucide-network",{"title":94,"path":95,"stem":96,"icon":57},"Notification Layer","\u002Ftechnical\u002Fpubsub","3.technical\u002F2.pubsub",{"title":98,"path":99,"stem":100,"icon":101},"Multi-Server Sync","\u002Ftechnical\u002Fcross-server-sync","3.technical\u002F3.cross-server-sync","i-lucide-server",{"title":103,"path":104,"stem":105,"children":106,"icon":108},"Blocks","\u002Fblocks","4.blocks\u002F1.index",[107],{"title":103,"path":104,"stem":105,"icon":108},"i-lucide-layout-grid",{"title":110,"path":111,"stem":112,"children":113,"icon":115},"Components","\u002Fcomponents","5.components\u002F1.index",[114],{"title":110,"path":111,"stem":112,"icon":115},"i-lucide-component",{"id":117,"title":118,"authors":119,"body":125,"category":733,"date":734,"description":735,"extension":736,"highlighted":42,"image":737,"meta":738,"navigation":739,"path":740,"seo":741,"stem":742,"tags":743,"__hash__":746},"blog\u002Fblog\u002Fversion-2-1.md","Nuxt Realtime 0.2.1",[120],{"name":121,"avatar":122,"to":124},"Daan van Geloven",{"src":123},"https:\u002F\u002Fgithub.com\u002Fdaanvangeloven.png","https:\u002F\u002Fgithub.com\u002Fdaanvangeloven",{"type":126,"value":127,"toc":726},"minimark",[128,132,137,153,171,311,320,324,331,337,341,344,443,447,450,690,696,700,713,722],[129,130,131],"p",{},"Nuxt Realtime 0.2.1 is a security release. We recommend everyone upgrade.",[133,134,136],"h2",{"id":135},"origin-check","Origin check",[129,138,139,140,144,145,148,149,152],{},"The realtime server now rejects cross-site WebSocket connections. Without ",[141,142,143],"code",{},"cors.origin",", only same-origin connections are accepted (",[141,146,147],{},"X-Forwarded-Host"," is honored behind a proxy). With it set, only the listed origins get in. Clients that send no ",[141,150,151],{},"Origin"," header, such as server-side or native clients, are still accepted.",[154,155,157],"callout",{"color":156},"warning",[129,158,159,160,163,164,166,167,170],{},"If your Nuxt app and realtime server run on different origins (for example a standalone server behind ",[141,161,162],{},"socketio.serverUrl","), set ",[141,165,143],{}," to your app's origin. The module logs a warning when ",[141,168,169],{},"serverUrl"," is set without it.",[172,173,179],"pre",{"className":174,"code":175,"filename":176,"language":177,"meta":178,"style":178},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineNuxtConfig({\n  nuxtRealtime: {\n    socketio: {\n      serverUrl: 'https:\u002F\u002Frealtime.example.com',\n      serverOptions: { cors: { origin: ['https:\u002F\u002Fapp.example.com'] } },\n    },\n  },\n})\n","nuxt.config.ts","ts","",[141,180,181,205,218,228,249,291,297,303],{"__ignoreMap":178},[182,183,186,190,193,197,201],"span",{"class":184,"line":185},"line",1,[182,187,189],{"class":188},"s7zQu","export",[182,191,192],{"class":188}," default",[182,194,196],{"class":195},"s2Zo4"," defineNuxtConfig",[182,198,200],{"class":199},"sTEyZ","(",[182,202,204],{"class":203},"sMK4o","{\n",[182,206,208,212,215],{"class":184,"line":207},2,[182,209,211],{"class":210},"swJcz","  nuxtRealtime",[182,213,214],{"class":203},":",[182,216,217],{"class":203}," {\n",[182,219,221,224,226],{"class":184,"line":220},3,[182,222,223],{"class":210},"    socketio",[182,225,214],{"class":203},[182,227,217],{"class":203},[182,229,231,234,236,239,243,246],{"class":184,"line":230},4,[182,232,233],{"class":210},"      serverUrl",[182,235,214],{"class":203},[182,237,238],{"class":203}," '",[182,240,242],{"class":241},"sfazB","https:\u002F\u002Frealtime.example.com",[182,244,245],{"class":203},"'",[182,247,248],{"class":203},",\n",[182,250,252,255,257,260,263,265,267,270,272,275,277,280,282,285,288],{"class":184,"line":251},5,[182,253,254],{"class":210},"      serverOptions",[182,256,214],{"class":203},[182,258,259],{"class":203}," {",[182,261,262],{"class":210}," cors",[182,264,214],{"class":203},[182,266,259],{"class":203},[182,268,269],{"class":210}," origin",[182,271,214],{"class":203},[182,273,274],{"class":199}," [",[182,276,245],{"class":203},[182,278,279],{"class":241},"https:\u002F\u002Fapp.example.com",[182,281,245],{"class":203},[182,283,284],{"class":199},"] ",[182,286,287],{"class":203},"}",[182,289,290],{"class":203}," },\n",[182,292,294],{"class":184,"line":293},6,[182,295,296],{"class":203},"    },\n",[182,298,300],{"class":184,"line":299},7,[182,301,302],{"class":203},"  },\n",[182,304,306,308],{"class":184,"line":305},8,[182,307,287],{"class":203},[182,309,310],{"class":199},")\n",[129,312,313,314,319],{},"See ",[315,316,318],"a",{"href":317},"\u002Fgetting-started\u002Fconfiguration#origin-check","origin check",".",[133,321,323],{"id":322},"reconnect-identity","Reconnect identity",[129,325,326,327,330],{},"A ",[141,328,329],{},"connectionId"," is visible to other clients, because it is the owner shown on locks and presence. It was never a credential, but it was treated like one. The server now issues a per-connection secret and only lets a client reclaim an id by presenting it, so nobody can take over another client's locks, presence or room membership. A client that loses its secret reconnects with a fresh identity.",[129,332,313,333,319],{},[315,334,336],{"href":335},"\u002Fgetting-started\u002Fauthentication#reconnect-identity","reconnect identity",[133,338,340],{"id":339},"limits","Limits",[129,342,343],{},"Each connection is now capped so a single client cannot exhaust server memory or storage. The defaults can be raised or lowered:",[172,345,347],{"className":174,"code":346,"filename":176,"language":177,"meta":178,"style":178},"export default defineNuxtConfig({\n  nuxtRealtime: {\n    limits: {\n      maxKeyLength: 256,\n      maxValueBytes: 262_144,\n      maxKeysPerSocket: 1000,\n      maxEventsPerSecond: 120,\n    },\n  },\n})\n",[141,348,349,361,369,378,391,403,415,427,431,436],{"__ignoreMap":178},[182,350,351,353,355,357,359],{"class":184,"line":185},[182,352,189],{"class":188},[182,354,192],{"class":188},[182,356,196],{"class":195},[182,358,200],{"class":199},[182,360,204],{"class":203},[182,362,363,365,367],{"class":184,"line":207},[182,364,211],{"class":210},[182,366,214],{"class":203},[182,368,217],{"class":203},[182,370,371,374,376],{"class":184,"line":220},[182,372,373],{"class":210},"    limits",[182,375,214],{"class":203},[182,377,217],{"class":203},[182,379,380,383,385,389],{"class":184,"line":230},[182,381,382],{"class":210},"      maxKeyLength",[182,384,214],{"class":203},[182,386,388],{"class":387},"sbssI"," 256",[182,390,248],{"class":203},[182,392,393,396,398,401],{"class":184,"line":251},[182,394,395],{"class":210},"      maxValueBytes",[182,397,214],{"class":203},[182,399,400],{"class":387}," 262_144",[182,402,248],{"class":203},[182,404,405,408,410,413],{"class":184,"line":293},[182,406,407],{"class":210},"      maxKeysPerSocket",[182,409,214],{"class":203},[182,411,412],{"class":387}," 1000",[182,414,248],{"class":203},[182,416,417,420,422,425],{"class":184,"line":299},[182,418,419],{"class":210},"      maxEventsPerSecond",[182,421,214],{"class":203},[182,423,424],{"class":387}," 120",[182,426,248],{"class":203},[182,428,429],{"class":184,"line":305},[182,430,296],{"class":203},[182,432,434],{"class":184,"line":433},9,[182,435,302],{"class":203},[182,437,439,441],{"class":184,"line":438},10,[182,440,287],{"class":203},[182,442,310],{"class":199},[133,444,446],{"id":445},"authorizing-subscriptions-and-publishes","Authorizing subscriptions and publishes",[129,448,449],{},"Any client could subscribe to any event channel or lock. Two new Nitro hooks let you restrict that. Both allow by default, and a hook that throws denies:",[172,451,454],{"className":174,"code":452,"filename":453,"language":177,"meta":178,"style":178},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('nuxt-realtime:canSubscribe', (ctx) => {\n    if (ctx.kind === 'event') ctx.allow = !ctx.name.startsWith('admin:') && ctx.name !== '*'\n  })\n  nitroApp.hooks.hook('nuxt-realtime:canPublish', (ctx) => {\n    ctx.allow = ctx.channel.startsWith('chat:')\n  })\n})\n","server\u002Fplugins\u002Frealtime-auth.ts",[141,455,456,482,521,605,612,645,678,684],{"__ignoreMap":178},[182,457,458,460,462,465,467,469,473,476,480],{"class":184,"line":185},[182,459,189],{"class":188},[182,461,192],{"class":188},[182,463,464],{"class":195}," defineNitroPlugin",[182,466,200],{"class":199},[182,468,200],{"class":203},[182,470,472],{"class":471},"sHdIc","nitroApp",[182,474,475],{"class":203},")",[182,477,479],{"class":478},"spNyl"," =>",[182,481,217],{"class":203},[182,483,484,487,489,492,494,497,499,501,504,506,509,512,515,517,519],{"class":184,"line":207},[182,485,486],{"class":199},"  nitroApp",[182,488,319],{"class":203},[182,490,491],{"class":199},"hooks",[182,493,319],{"class":203},[182,495,496],{"class":195},"hook",[182,498,200],{"class":210},[182,500,245],{"class":203},[182,502,503],{"class":241},"nuxt-realtime:canSubscribe",[182,505,245],{"class":203},[182,507,508],{"class":203},",",[182,510,511],{"class":203}," (",[182,513,514],{"class":471},"ctx",[182,516,475],{"class":203},[182,518,479],{"class":478},[182,520,217],{"class":203},[182,522,523,526,528,530,532,535,538,540,543,545,548,550,552,555,558,561,563,565,568,570,573,575,577,580,582,584,587,590,592,594,597,599,602],{"class":184,"line":220},[182,524,525],{"class":188},"    if",[182,527,511],{"class":210},[182,529,514],{"class":199},[182,531,319],{"class":203},[182,533,534],{"class":199},"kind",[182,536,537],{"class":203}," ===",[182,539,238],{"class":203},[182,541,542],{"class":241},"event",[182,544,245],{"class":203},[182,546,547],{"class":210},") ",[182,549,514],{"class":199},[182,551,319],{"class":203},[182,553,554],{"class":199},"allow",[182,556,557],{"class":203}," =",[182,559,560],{"class":203}," !",[182,562,514],{"class":199},[182,564,319],{"class":203},[182,566,567],{"class":199},"name",[182,569,319],{"class":203},[182,571,572],{"class":195},"startsWith",[182,574,200],{"class":210},[182,576,245],{"class":203},[182,578,579],{"class":241},"admin:",[182,581,245],{"class":203},[182,583,547],{"class":210},[182,585,586],{"class":203},"&&",[182,588,589],{"class":199}," ctx",[182,591,319],{"class":203},[182,593,567],{"class":199},[182,595,596],{"class":203}," !==",[182,598,238],{"class":203},[182,600,601],{"class":241},"*",[182,603,604],{"class":203},"'\n",[182,606,607,610],{"class":184,"line":230},[182,608,609],{"class":203},"  }",[182,611,310],{"class":210},[182,613,614,616,618,620,622,624,626,628,631,633,635,637,639,641,643],{"class":184,"line":251},[182,615,486],{"class":199},[182,617,319],{"class":203},[182,619,491],{"class":199},[182,621,319],{"class":203},[182,623,496],{"class":195},[182,625,200],{"class":210},[182,627,245],{"class":203},[182,629,630],{"class":241},"nuxt-realtime:canPublish",[182,632,245],{"class":203},[182,634,508],{"class":203},[182,636,511],{"class":203},[182,638,514],{"class":471},[182,640,475],{"class":203},[182,642,479],{"class":478},[182,644,217],{"class":203},[182,646,647,650,652,654,656,658,660,663,665,667,669,671,674,676],{"class":184,"line":293},[182,648,649],{"class":199},"    ctx",[182,651,319],{"class":203},[182,653,554],{"class":199},[182,655,557],{"class":203},[182,657,589],{"class":199},[182,659,319],{"class":203},[182,661,662],{"class":199},"channel",[182,664,319],{"class":203},[182,666,572],{"class":195},[182,668,200],{"class":210},[182,670,245],{"class":203},[182,672,673],{"class":241},"chat:",[182,675,245],{"class":203},[182,677,310],{"class":210},[182,679,680,682],{"class":184,"line":299},[182,681,609],{"class":203},[182,683,310],{"class":210},[182,685,686,688],{"class":184,"line":305},[182,687,287],{"class":203},[182,689,310],{"class":199},[129,691,313,692,319],{},[315,693,695],{"href":694},"\u002Fgetting-started\u002Fconfiguration#authorizing-reads-and-writes","authorizing subscriptions and publishes",[133,697,699],{"id":698},"also-in-this-release","Also in this release",[701,702,703,707,710],"ul",{},[704,705,706],"li",{},"Input validation on storage, lock, presence, room and event payloads.",[704,708,709],{},"Dependency updates for security fixes.",[704,711,712],{},"Node.js is locked to 24.",[129,714,715,716,319],{},"The full list is in the ",[315,717,721],{"href":718,"rel":719},"https:\u002F\u002Fgithub.com\u002Fdaanvangeloven\u002Fnuxt-realtime\u002Fblob\u002Fmaster\u002FCHANGELOG.md",[720],"nofollow","changelog",[723,724,725],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}",{"title":178,"searchDepth":185,"depth":207,"links":727},[728,729,730,731,732],{"id":135,"depth":207,"text":136},{"id":322,"depth":207,"text":323},{"id":339,"depth":207,"text":340},{"id":445,"depth":207,"text":446},{"id":698,"depth":207,"text":699},"Release","2026-10-26","Security hardening for the realtime server, including origin checks, reconnect secrets, per-connection limits and authorization hooks.","md",null,{},true,"\u002Fblog\u002Fversion-2-1",{"title":118,"description":735},"blog\u002Fversion-2-1",[744,745],"release","security","4IaDdV2yCtOv_LoJGv9UQFVdG76cQXum3sOAy8-_eyo",[748,753],{"title":749,"path":750,"stem":751,"description":752,"children":-1},"Nuxt Realtime 0.3","\u002Fblog\u002Fversion-3","blog\u002Fversion-3","Secure by default. Required authentication, gate hooks for every read and write, server-owned identity, and extension seams for your own events.",{"title":754,"path":755,"stem":756,"description":757,"children":-1},"Nuxt Realtime 0.2","\u002Fblog\u002Fversion-2","blog\u002Fversion-2","DevTools, connection auth, and presence\u002Flocking\u002Frooms land in Nuxt Realtime 0.2.",1796040901290]