[{"data":1,"prerenderedAt":4223},["ShallowReactive",2],{"navigation":3,"\u002Fgetting-started\u002Fsecuring-your-app":116,"\u002Fgetting-started\u002Fsecuring-your-app-surround":4218},[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":33,"body":118,"description":4211,"extension":4212,"links":4213,"meta":4214,"navigation":4215,"path":34,"seo":4216,"stem":35,"__hash__":4217},"docs\u002F1.getting-started\u002F6.securing-your-app.md",{"type":119,"value":120,"toc":4179},"minimark",[121,134,137,221,227,274,279,289,397,404,429,443,446,451,478,677,694,698,709,804,810,975,991,997,1001,1019,1034,1047,1079,1083,1086,1219,1228,1330,1666,1680,1684,1687,1713,1719,1723,1734,1738,1752,1894,2004,2026,2041,2045,2048,2052,2058,2182,2255,2260,2264,2267,2407,2414,2521,2525,2536,2630,2633,2637,2648,2668,3125,3128,3391,3805,3818,3822,3863,3869,3873,3879,3910,3913,3917,3920,3924,3946,3950,3956,3960,3978,3982,3995,3999,4011,4015,4024,4028,4037,4041,4051,4055,4109,4113,4119,4175],[122,123,124],"callout",{"icon":36},[125,126,127,128,133],"p",{},"Read the ",[129,130,132],"a",{"href":131},"#known-limits","known limits"," before you expose it to real users.",[125,135,136],{},"By default the realtime server accepts any connection and lets it read and write any non-reserved key. That is fine for a prototype. For a real app, turn on required authentication. Then every connection has a verified user, and every read, write and join goes through a hook you control.",[138,139,145],"pre",{"className":140,"code":141,"filename":142,"language":143,"meta":144,"style":144},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineNuxtConfig({\n  nuxtRealtime: {\n    auth: 'required',\n  },\n})\n","nuxt.config.ts","ts","",[146,147,148,172,185,206,212],"code",{"__ignoreMap":144},[149,150,153,157,160,164,168],"span",{"class":151,"line":152},"line",1,[149,154,156],{"class":155},"s7zQu","export",[149,158,159],{"class":155}," default",[149,161,163],{"class":162},"s2Zo4"," defineNuxtConfig",[149,165,167],{"class":166},"sTEyZ","(",[149,169,171],{"class":170},"sMK4o","{\n",[149,173,175,179,182],{"class":151,"line":174},2,[149,176,178],{"class":177},"swJcz","  nuxtRealtime",[149,180,181],{"class":170},":",[149,183,184],{"class":170}," {\n",[149,186,188,191,193,196,200,203],{"class":151,"line":187},3,[149,189,190],{"class":177},"    auth",[149,192,181],{"class":170},[149,194,195],{"class":170}," '",[149,197,199],{"class":198},"sfazB","required",[149,201,202],{"class":170},"'",[149,204,205],{"class":170},",\n",[149,207,209],{"class":151,"line":208},4,[149,210,211],{"class":170},"  },\n",[149,213,215,218],{"class":151,"line":214},5,[149,216,217],{"class":170},"}",[149,219,220],{"class":166},")\n",[125,222,223,224,181],{},"With ",[146,225,226],{},"auth: 'required'",[228,229,230,238,255],"ul",{},[231,232,233,234,237],"li",{},"A connection that no ",[146,235,236],{},"nuxt-realtime:authenticate"," hook identified is refused before the transport opens.",[231,239,240,241,244,245,244,248,244,251,254],{},"The gates (",[146,242,243],{},"canJoinRoom",", ",[146,246,247],{},"canSubscribe",[146,249,250],{},"canPublish",[146,252,253],{},"canWrite",") deny by default. You allow what you want in hooks.",[231,256,257,258,261,262,265,266,269,270,273],{},"Presence ",[146,259,260],{},"info"," and lock ",[146,263,264],{},"ownerInfo"," are ",[146,267,268],{},"null"," unless a ",[146,271,272],{},"nuxt-realtime:publicInfo"," hook sets them.",[275,276,278],"h2",{"id":277},"authenticate-connections","Authenticate connections",[125,280,281,282,284,285,288],{},"Register the ",[146,283,236],{}," Nitro hook and set ",[146,286,287],{},"ctx.user"," to the verified user.",[138,290,292],{"className":140,"code":291,"language":143,"meta":144,"style":144},"interface AuthenticateContext {\n  event: H3Event\n  req: IncomingMessage\n  transport: 'polling' | 'websocket'\n  user: unknown\n  reject: (reason?: string) => void\n}\n",[146,293,294,306,316,326,351,361,391],{"__ignoreMap":144},[149,295,296,300,304],{"class":151,"line":152},[149,297,299],{"class":298},"spNyl","interface",[149,301,303],{"class":302},"sBMFI"," AuthenticateContext",[149,305,184],{"class":170},[149,307,308,311,313],{"class":151,"line":174},[149,309,310],{"class":177},"  event",[149,312,181],{"class":170},[149,314,315],{"class":302}," H3Event\n",[149,317,318,321,323],{"class":151,"line":187},[149,319,320],{"class":177},"  req",[149,322,181],{"class":170},[149,324,325],{"class":302}," IncomingMessage\n",[149,327,328,331,333,335,338,340,343,345,348],{"class":151,"line":208},[149,329,330],{"class":177},"  transport",[149,332,181],{"class":170},[149,334,195],{"class":170},[149,336,337],{"class":198},"polling",[149,339,202],{"class":170},[149,341,342],{"class":170}," |",[149,344,195],{"class":170},[149,346,347],{"class":198},"websocket",[149,349,350],{"class":170},"'\n",[149,352,353,356,358],{"class":151,"line":214},[149,354,355],{"class":177},"  user",[149,357,181],{"class":170},[149,359,360],{"class":302}," unknown\n",[149,362,364,367,369,372,376,379,382,385,388],{"class":151,"line":363},6,[149,365,366],{"class":177},"  reject",[149,368,181],{"class":170},[149,370,371],{"class":170}," (",[149,373,375],{"class":374},"sHdIc","reason",[149,377,378],{"class":170},"?:",[149,380,381],{"class":302}," string",[149,383,384],{"class":170},")",[149,386,387],{"class":298}," =>",[149,389,390],{"class":302}," void\n",[149,392,394],{"class":151,"line":393},7,[149,395,396],{"class":170},"}\n",[125,398,399,400,403],{},"The hook runs before the connection opens. For the polling transport it runs on the Engine.IO handshake. For WebSocket it runs on the upgrade request, before the server answers ",[146,401,402],{},"101",". A connection is refused when:",[228,405,406,413,416],{},[231,407,408,409,412],{},"a hook calls ",[146,410,411],{},"ctx.reject()",",",[231,414,415],{},"a hook throws, or",[231,417,418,421,422,425,426,428],{},[146,419,420],{},"auth"," is ",[146,423,424],{},"'required'"," and ",[146,427,287],{}," is still empty after all hooks ran.",[125,430,431,432,435,436,439,440,442],{},"A refused polling handshake gets a ",[146,433,434],{},"403"," and no session id. A refused WebSocket upgrade gets a ",[146,437,438],{},"401"," (a disallowed origin gets a ",[146,441,434],{},"). In both cases the socket never opens.",[125,444,445],{},"The hook can run twice for one connection: once for the polling handshake and once when the client upgrades to WebSocket. Keep it fast and free of side effects. The socket keeps the user from the handshake.",[447,448,450],"h3",{"id":449},"cookie-or-session","Cookie or session",[125,452,453,456,457,244,460,244,463,425,466,469,470,473,474,477],{},[146,454,455],{},"ctx.event"," is an h3 event built from the request, so h3's read helpers work: ",[146,458,459],{},"getCookie",[146,461,462],{},"getHeader",[146,464,465],{},"getQuery",[146,467,468],{},"getSession","\u002F",[146,471,472],{},"useSession",". Write helpers such as ",[146,475,476],{},"setCookie"," have no effect, because there is no real response at this point.",[138,479,482],{"className":140,"code":480,"filename":481,"language":143,"meta":144,"style":144},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('nuxt-realtime:authenticate', async (ctx) => {\n    const session = await getSession\u003C{ user?: { id: string, name: string } }>(ctx.event, {\n      password: process.env.SESSION_SECRET!,\n    })\n    ctx.user = session.data.user\n  })\n})\n","server\u002Fplugins\u002Frealtime-authenticate.ts",[146,483,484,506,546,609,632,639,663,670],{"__ignoreMap":144},[149,485,486,488,490,493,495,497,500,502,504],{"class":151,"line":152},[149,487,156],{"class":155},[149,489,159],{"class":155},[149,491,492],{"class":162}," defineNitroPlugin",[149,494,167],{"class":166},[149,496,167],{"class":170},[149,498,499],{"class":374},"nitroApp",[149,501,384],{"class":170},[149,503,387],{"class":298},[149,505,184],{"class":170},[149,507,508,511,514,517,519,522,524,526,528,530,532,535,537,540,542,544],{"class":151,"line":174},[149,509,510],{"class":166},"  nitroApp",[149,512,513],{"class":170},".",[149,515,516],{"class":166},"hooks",[149,518,513],{"class":170},[149,520,521],{"class":162},"hook",[149,523,167],{"class":177},[149,525,202],{"class":170},[149,527,236],{"class":198},[149,529,202],{"class":170},[149,531,412],{"class":170},[149,533,534],{"class":298}," async",[149,536,371],{"class":170},[149,538,539],{"class":374},"ctx",[149,541,384],{"class":170},[149,543,387],{"class":298},[149,545,184],{"class":170},[149,547,548,551,554,557,560,563,566,569,571,574,577,579,581,583,586,588,590,593,596,598,600,602,605,607],{"class":151,"line":187},[149,549,550],{"class":298},"    const",[149,552,553],{"class":166}," session",[149,555,556],{"class":170}," =",[149,558,559],{"class":155}," await",[149,561,562],{"class":162}," getSession",[149,564,565],{"class":170},"\u003C{",[149,567,568],{"class":177}," user",[149,570,378],{"class":170},[149,572,573],{"class":170}," {",[149,575,576],{"class":177}," id",[149,578,181],{"class":170},[149,580,381],{"class":302},[149,582,412],{"class":170},[149,584,585],{"class":177}," name",[149,587,181],{"class":170},[149,589,381],{"class":302},[149,591,592],{"class":170}," }",[149,594,595],{"class":170}," }>",[149,597,167],{"class":177},[149,599,539],{"class":166},[149,601,513],{"class":170},[149,603,604],{"class":166},"event",[149,606,412],{"class":170},[149,608,184],{"class":170},[149,610,611,614,616,619,621,624,626,629],{"class":151,"line":208},[149,612,613],{"class":177},"      password",[149,615,181],{"class":170},[149,617,618],{"class":166}," process",[149,620,513],{"class":170},[149,622,623],{"class":166},"env",[149,625,513],{"class":170},[149,627,628],{"class":166},"SESSION_SECRET",[149,630,631],{"class":170},"!,\n",[149,633,634,637],{"class":151,"line":214},[149,635,636],{"class":170},"    }",[149,638,220],{"class":177},[149,640,641,644,646,649,651,653,655,658,660],{"class":151,"line":363},[149,642,643],{"class":166},"    ctx",[149,645,513],{"class":170},[149,647,648],{"class":166},"user",[149,650,556],{"class":170},[149,652,553],{"class":166},[149,654,513],{"class":170},[149,656,657],{"class":166},"data",[149,659,513],{"class":170},[149,661,662],{"class":166},"user\n",[149,664,665,668],{"class":151,"line":393},[149,666,667],{"class":170},"  }",[149,669,220],{"class":177},[149,671,673,675],{"class":151,"line":672},8,[149,674,217],{"class":170},[149,676,220],{"class":166},[125,678,679,680,682,683,685,686,689,690,693],{},"A request without a session gives an empty session, not an error, so ",[146,681,287],{}," stays empty and ",[146,684,226],{}," refuses it. If you use ",[146,687,688],{},"nuxt-auth-utils",", its ",[146,691,692],{},"getUserSession(ctx.event)"," is built on the same h3 session helper. Only the h3 helpers themselves are covered by this module's tests.",[447,695,697],{"id":696},"token-in-the-query","Token in the query",[125,699,700,701,704,705,708],{},"A browser WebSocket cannot send custom headers, and cookies do not cross origins. Send a token in the handshake query instead. The client side is the ",[146,702,703],{},"nuxt-realtime:auth"," hook, where ",[146,706,707],{},"ctx.query"," becomes the Engine.IO handshake query:",[138,710,713],{"className":140,"code":711,"filename":712,"language":143,"meta":144,"style":144},"export default defineNuxtPlugin((nuxtApp) => {\n  nuxtApp.hook('nuxt-realtime:auth', async (ctx) => {\n    ctx.query.token = await fetchRealtimeToken()\n  })\n})\n","plugins\u002Frealtime-auth.client.ts",[146,714,715,737,768,792,798],{"__ignoreMap":144},[149,716,717,719,721,724,726,728,731,733,735],{"class":151,"line":152},[149,718,156],{"class":155},[149,720,159],{"class":155},[149,722,723],{"class":162}," defineNuxtPlugin",[149,725,167],{"class":166},[149,727,167],{"class":170},[149,729,730],{"class":374},"nuxtApp",[149,732,384],{"class":170},[149,734,387],{"class":298},[149,736,184],{"class":170},[149,738,739,742,744,746,748,750,752,754,756,758,760,762,764,766],{"class":151,"line":174},[149,740,741],{"class":166},"  nuxtApp",[149,743,513],{"class":170},[149,745,521],{"class":162},[149,747,167],{"class":177},[149,749,202],{"class":170},[149,751,703],{"class":198},[149,753,202],{"class":170},[149,755,412],{"class":170},[149,757,534],{"class":298},[149,759,371],{"class":170},[149,761,539],{"class":374},[149,763,384],{"class":170},[149,765,387],{"class":298},[149,767,184],{"class":170},[149,769,770,772,774,777,779,782,784,786,789],{"class":151,"line":187},[149,771,643],{"class":166},[149,773,513],{"class":170},[149,775,776],{"class":166},"query",[149,778,513],{"class":170},[149,780,781],{"class":166},"token",[149,783,556],{"class":170},[149,785,559],{"class":155},[149,787,788],{"class":162}," fetchRealtimeToken",[149,790,791],{"class":177},"()\n",[149,793,794,796],{"class":151,"line":208},[149,795,667],{"class":170},[149,797,220],{"class":177},[149,799,800,802],{"class":151,"line":214},[149,801,217],{"class":170},[149,803,220],{"class":166},[125,805,806,807,809],{},"On the server, read it with ",[146,808,465],{}," and verify it:",[138,811,813],{"className":140,"code":812,"filename":481,"language":143,"meta":144,"style":144},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('nuxt-realtime:authenticate', async (ctx) => {\n    const { token } = getQuery(ctx.event)\n    if (typeof token !== 'string') return ctx.reject('Missing token')\n    ctx.user = await verifyRealtimeToken(token)\n  })\n})\n",[146,814,815,835,869,895,942,963,969],{"__ignoreMap":144},[149,816,817,819,821,823,825,827,829,831,833],{"class":151,"line":152},[149,818,156],{"class":155},[149,820,159],{"class":155},[149,822,492],{"class":162},[149,824,167],{"class":166},[149,826,167],{"class":170},[149,828,499],{"class":374},[149,830,384],{"class":170},[149,832,387],{"class":298},[149,834,184],{"class":170},[149,836,837,839,841,843,845,847,849,851,853,855,857,859,861,863,865,867],{"class":151,"line":174},[149,838,510],{"class":166},[149,840,513],{"class":170},[149,842,516],{"class":166},[149,844,513],{"class":170},[149,846,521],{"class":162},[149,848,167],{"class":177},[149,850,202],{"class":170},[149,852,236],{"class":198},[149,854,202],{"class":170},[149,856,412],{"class":170},[149,858,534],{"class":298},[149,860,371],{"class":170},[149,862,539],{"class":374},[149,864,384],{"class":170},[149,866,387],{"class":298},[149,868,184],{"class":170},[149,870,871,873,875,878,880,882,885,887,889,891,893],{"class":151,"line":187},[149,872,550],{"class":298},[149,874,573],{"class":170},[149,876,877],{"class":166}," token",[149,879,592],{"class":170},[149,881,556],{"class":170},[149,883,884],{"class":162}," getQuery",[149,886,167],{"class":177},[149,888,539],{"class":166},[149,890,513],{"class":170},[149,892,604],{"class":166},[149,894,220],{"class":177},[149,896,897,900,902,905,907,910,912,915,917,920,923,926,928,931,933,935,938,940],{"class":151,"line":208},[149,898,899],{"class":155},"    if",[149,901,371],{"class":177},[149,903,904],{"class":170},"typeof",[149,906,877],{"class":166},[149,908,909],{"class":170}," !==",[149,911,195],{"class":170},[149,913,914],{"class":198},"string",[149,916,202],{"class":170},[149,918,919],{"class":177},") ",[149,921,922],{"class":155},"return",[149,924,925],{"class":166}," ctx",[149,927,513],{"class":170},[149,929,930],{"class":162},"reject",[149,932,167],{"class":177},[149,934,202],{"class":170},[149,936,937],{"class":198},"Missing token",[149,939,202],{"class":170},[149,941,220],{"class":177},[149,943,944,946,948,950,952,954,957,959,961],{"class":151,"line":214},[149,945,643],{"class":166},[149,947,513],{"class":170},[149,949,648],{"class":166},[149,951,556],{"class":170},[149,953,559],{"class":155},[149,955,956],{"class":162}," verifyRealtimeToken",[149,958,167],{"class":177},[149,960,781],{"class":166},[149,962,220],{"class":177},[149,964,965,967],{"class":151,"line":363},[149,966,667],{"class":170},[149,968,220],{"class":177},[149,970,971,973],{"class":151,"line":393},[149,972,217],{"class":170},[149,974,220],{"class":166},[122,976,978],{"icon":977,"color":260},"i-lucide-info",[125,979,980,983,984,987,988,990],{},[146,981,982],{},"ctx.auth"," is sent at Socket.IO connect time, after the transport is already open. It is too late for ",[146,985,986],{},"authenticate",". Use ",[146,989,707],{}," for anything the server must check up front. On a reconnect the query is one attempt behind: the hook runs for the next attempt, so the first retry sends the value from the previous run.",[125,992,993,994,996],{},"The client connects after the ",[146,995,703],{}," hook has finished, so the first attempt always carries the query.",[275,998,1000],{"id":999},"identity-is-owned-by-the-server","Identity is owned by the server",[125,1002,1003,1004,1007,1008,1011,1012,1015,1016,1018],{},"The verified user lives in ",[146,1005,1006],{},"socket.data.user",". The module sets it before your ",[146,1009,1010],{},"nuxt-realtime:io"," middleware runs, so every hook and ",[146,1013,1014],{},"io.use()"," middleware sees it. With ",[146,1017,226],{},", a socket whose user an app middleware cleared is disconnected.",[125,1020,1021,1022,244,1024,244,1027,1029,1030,1033],{},"No client-supplied field can set the user, the connection owner or lock ownership. A ",[146,1023,648],{},[146,1025,1026],{},"owner",[146,1028,264],{}," or ",[146,1031,1032],{},"connectionId"," inside a payload is treated as plain data.",[125,1035,1036,1038,1039,1042,1043,1046],{},[146,1037,1006],{}," is typed as ",[146,1040,1041],{},"any",". Narrow it by extending Socket.IO's ",[146,1044,1045],{},"SocketData"," interface.",[125,1048,1049,1050,1052,1053,1057,1058,1061,1062,425,1064,1067,1068,1071,1072,421,1075,1078],{},"The ",[146,1051,1032],{}," is a reconnect handle, not a credential. See ",[129,1054,1056],{"href":1055},"\u002Fgetting-started\u002Fauthentication#reconnect-identity","Reconnect identity",". To refuse a socket after you looked up more about it, use the ",[146,1059,1060],{},"nuxt-realtime:identify"," hook, which has ",[146,1063,287],{},[146,1065,1066],{},"ctx.reject(reason?)",". ",[146,1069,1070],{},"identify"," runs for every socket; ",[146,1073,1074],{},"ctx.connectionId",[146,1076,1077],{},"socket.id"," when the client sent none. No socket handler runs until it has finished, and messages from a rejected socket are dropped.",[275,1080,1082],{"id":1081},"gate-hooks","Gate hooks",[125,1084,1085],{},"Five hooks decide what a connection may do. Register them in a Nitro plugin.",[1087,1088,1089,1105],"table",{},[1090,1091,1092],"thead",{},[1093,1094,1095,1099,1102],"tr",{},[1096,1097,1098],"th",{},"Hook",[1096,1100,1101],{},"Runs on",[1096,1103,1104],{},"Default",[1106,1107,1108,1136,1172,1188,1204],"tbody",{},[1093,1109,1110,1116,1131],{},[1111,1112,1113],"td",{},[146,1114,1115],{},"nuxt-realtime:canJoinRoom",[1111,1117,1118,1119,244,1122,244,1125,244,1128],{},"every explicit join: ",[146,1120,1121],{},"room:join",[146,1123,1124],{},"presence:join",[146,1126,1127],{},"presence:subscribeRoom",[146,1129,1130],{},"lock:subscribeRoom",[1111,1132,1133,1134],{},"allow, deny with ",[146,1135,226],{},[1093,1137,1138,1143,1168],{},[1111,1139,1140],{},[146,1141,1142],{},"nuxt-realtime:canSubscribe",[1111,1144,1145,244,1148,1151,1152,1155,1156,244,1159,1161,1162,244,1165],{},[146,1146,1147],{},"event:subscribe",[146,1149,1150],{},"lock:subscribe",", every ",[146,1153,1154],{},"lock:claim"," (with a ",[146,1157,1158],{},"room",[146,1160,243],{}," must allow too), and state reads: ",[146,1163,1164],{},"storage:get",[146,1166,1167],{},"storage:subscribe",[1111,1169,1133,1170],{},[146,1171,226],{},[1093,1173,1174,1179,1184],{},[1111,1175,1176],{},[146,1177,1178],{},"nuxt-realtime:canPublish",[1111,1180,1181],{},[146,1182,1183],{},"event:publish",[1111,1185,1133,1186],{},[146,1187,226],{},[1093,1189,1190,1195,1200],{},[1111,1191,1192],{},[146,1193,1194],{},"nuxt-realtime:canWrite",[1111,1196,1197],{},[146,1198,1199],{},"storage:set",[1111,1201,1133,1202],{},[146,1203,226],{},[1093,1205,1206,1211,1216],{},[1111,1207,1208],{},[146,1209,1210],{},"nuxt-realtime:canForceRelease",[1111,1212,1213],{},[146,1214,1215],{},"lock:forceRelease",[1111,1217,1218],{},"always deny",[125,1220,1221,1222,425,1224,1227],{},"Every gate context has ",[146,1223,648],{},[146,1225,1226],{},"socket"," next to its own fields:",[138,1229,1231],{"className":140,"code":1230,"language":143,"meta":144,"style":144},"interface GateContext {\n  user: unknown\n  socket: Socket\n  deny: (reason?: string) => void\n  allow?: boolean \u002F\u002F starts undefined\n}\n\u002F\u002F canJoinRoom:     { roomId, connectionId }\n\u002F\u002F canSubscribe:    { kind: 'event' | 'lock' | 'state', name, connectionId }\n\u002F\u002F canPublish:      { channel, data, connectionId }\n\u002F\u002F canWrite:        { key, value, connectionId }   \u002F\u002F key is normalized\n\u002F\u002F canForceRelease: { key, connectionId, currentOwner }\n",[146,1232,1233,1242,1250,1260,1281,1295,1299,1304,1309,1315,1324],{"__ignoreMap":144},[149,1234,1235,1237,1240],{"class":151,"line":152},[149,1236,299],{"class":298},[149,1238,1239],{"class":302}," GateContext",[149,1241,184],{"class":170},[149,1243,1244,1246,1248],{"class":151,"line":174},[149,1245,355],{"class":177},[149,1247,181],{"class":170},[149,1249,360],{"class":302},[149,1251,1252,1255,1257],{"class":151,"line":187},[149,1253,1254],{"class":177},"  socket",[149,1256,181],{"class":170},[149,1258,1259],{"class":302}," Socket\n",[149,1261,1262,1265,1267,1269,1271,1273,1275,1277,1279],{"class":151,"line":208},[149,1263,1264],{"class":177},"  deny",[149,1266,181],{"class":170},[149,1268,371],{"class":170},[149,1270,375],{"class":374},[149,1272,378],{"class":170},[149,1274,381],{"class":302},[149,1276,384],{"class":170},[149,1278,387],{"class":298},[149,1280,390],{"class":302},[149,1282,1283,1286,1288,1291],{"class":151,"line":214},[149,1284,1285],{"class":177},"  allow",[149,1287,378],{"class":170},[149,1289,1290],{"class":302}," boolean",[149,1292,1294],{"class":1293},"sHwdD"," \u002F\u002F starts undefined\n",[149,1296,1297],{"class":151,"line":363},[149,1298,396],{"class":170},[149,1300,1301],{"class":151,"line":393},[149,1302,1303],{"class":1293},"\u002F\u002F canJoinRoom:     { roomId, connectionId }\n",[149,1305,1306],{"class":151,"line":672},[149,1307,1308],{"class":1293},"\u002F\u002F canSubscribe:    { kind: 'event' | 'lock' | 'state', name, connectionId }\n",[149,1310,1312],{"class":151,"line":1311},9,[149,1313,1314],{"class":1293},"\u002F\u002F canPublish:      { channel, data, connectionId }\n",[149,1316,1318,1321],{"class":151,"line":1317},10,[149,1319,1320],{"class":1293},"\u002F\u002F canWrite:        { key, value, connectionId }",[149,1322,1323],{"class":1293},"   \u002F\u002F key is normalized\n",[149,1325,1327],{"class":151,"line":1326},11,[149,1328,1329],{"class":1293},"\u002F\u002F canForceRelease: { key, connectionId, currentOwner }\n",[138,1331,1334],{"className":140,"code":1332,"filename":1333,"language":143,"meta":144,"style":144},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('nuxt-realtime:canWrite', (ctx) => {\n    const user = ctx.user as { id: string }\n    \u002F\u002F clients may only write keys under their own user id\n    if (ctx.key.startsWith(`user:${user.id}:`)) ctx.allow = true\n    else ctx.deny('Not your key')\n  })\n\n  nitroApp.hooks.hook('nuxt-realtime:canSubscribe', (ctx) => {\n    \u002F\u002F `*` also receives admin: events, so it is denied too\n    if (ctx.kind === 'event' && (ctx.name.startsWith('admin:') || ctx.name === '*')) ctx.deny('Admins only')\n    else ctx.allow = true\n  })\n})\n","server\u002Fplugins\u002Frealtime-gates.ts",[146,1335,1336,1356,1388,1416,1421,1479,1502,1508,1514,1546,1551,1637,1652,1659],{"__ignoreMap":144},[149,1337,1338,1340,1342,1344,1346,1348,1350,1352,1354],{"class":151,"line":152},[149,1339,156],{"class":155},[149,1341,159],{"class":155},[149,1343,492],{"class":162},[149,1345,167],{"class":166},[149,1347,167],{"class":170},[149,1349,499],{"class":374},[149,1351,384],{"class":170},[149,1353,387],{"class":298},[149,1355,184],{"class":170},[149,1357,1358,1360,1362,1364,1366,1368,1370,1372,1374,1376,1378,1380,1382,1384,1386],{"class":151,"line":174},[149,1359,510],{"class":166},[149,1361,513],{"class":170},[149,1363,516],{"class":166},[149,1365,513],{"class":170},[149,1367,521],{"class":162},[149,1369,167],{"class":177},[149,1371,202],{"class":170},[149,1373,1194],{"class":198},[149,1375,202],{"class":170},[149,1377,412],{"class":170},[149,1379,371],{"class":170},[149,1381,539],{"class":374},[149,1383,384],{"class":170},[149,1385,387],{"class":298},[149,1387,184],{"class":170},[149,1389,1390,1392,1394,1396,1398,1400,1402,1405,1407,1409,1411,1413],{"class":151,"line":187},[149,1391,550],{"class":298},[149,1393,568],{"class":166},[149,1395,556],{"class":170},[149,1397,925],{"class":166},[149,1399,513],{"class":170},[149,1401,648],{"class":166},[149,1403,1404],{"class":155}," as",[149,1406,573],{"class":170},[149,1408,576],{"class":177},[149,1410,181],{"class":170},[149,1412,381],{"class":302},[149,1414,1415],{"class":170}," }\n",[149,1417,1418],{"class":151,"line":208},[149,1419,1420],{"class":1293},"    \u002F\u002F clients may only write keys under their own user id\n",[149,1422,1423,1425,1427,1429,1431,1434,1436,1439,1441,1444,1447,1450,1452,1454,1457,1459,1461,1463,1466,1468,1470,1473,1475],{"class":151,"line":214},[149,1424,899],{"class":155},[149,1426,371],{"class":177},[149,1428,539],{"class":166},[149,1430,513],{"class":170},[149,1432,1433],{"class":166},"key",[149,1435,513],{"class":170},[149,1437,1438],{"class":162},"startsWith",[149,1440,167],{"class":177},[149,1442,1443],{"class":170},"`",[149,1445,1446],{"class":198},"user:",[149,1448,1449],{"class":170},"${",[149,1451,648],{"class":166},[149,1453,513],{"class":170},[149,1455,1456],{"class":166},"id",[149,1458,217],{"class":170},[149,1460,181],{"class":198},[149,1462,1443],{"class":170},[149,1464,1465],{"class":177},")) ",[149,1467,539],{"class":166},[149,1469,513],{"class":170},[149,1471,1472],{"class":166},"allow",[149,1474,556],{"class":170},[149,1476,1478],{"class":1477},"sfNiH"," true\n",[149,1480,1481,1484,1486,1488,1491,1493,1495,1498,1500],{"class":151,"line":363},[149,1482,1483],{"class":155},"    else",[149,1485,925],{"class":166},[149,1487,513],{"class":170},[149,1489,1490],{"class":162},"deny",[149,1492,167],{"class":177},[149,1494,202],{"class":170},[149,1496,1497],{"class":198},"Not your key",[149,1499,202],{"class":170},[149,1501,220],{"class":177},[149,1503,1504,1506],{"class":151,"line":393},[149,1505,667],{"class":170},[149,1507,220],{"class":177},[149,1509,1510],{"class":151,"line":672},[149,1511,1513],{"emptyLinePlaceholder":1512},true,"\n",[149,1515,1516,1518,1520,1522,1524,1526,1528,1530,1532,1534,1536,1538,1540,1542,1544],{"class":151,"line":1311},[149,1517,510],{"class":166},[149,1519,513],{"class":170},[149,1521,516],{"class":166},[149,1523,513],{"class":170},[149,1525,521],{"class":162},[149,1527,167],{"class":177},[149,1529,202],{"class":170},[149,1531,1142],{"class":198},[149,1533,202],{"class":170},[149,1535,412],{"class":170},[149,1537,371],{"class":170},[149,1539,539],{"class":374},[149,1541,384],{"class":170},[149,1543,387],{"class":298},[149,1545,184],{"class":170},[149,1547,1548],{"class":151,"line":1317},[149,1549,1550],{"class":1293},"    \u002F\u002F `*` also receives admin: events, so it is denied too\n",[149,1552,1553,1555,1557,1559,1561,1564,1567,1569,1571,1573,1576,1578,1580,1582,1585,1587,1589,1591,1593,1596,1598,1600,1603,1605,1607,1609,1611,1613,1616,1618,1620,1622,1624,1626,1628,1630,1633,1635],{"class":151,"line":1326},[149,1554,899],{"class":155},[149,1556,371],{"class":177},[149,1558,539],{"class":166},[149,1560,513],{"class":170},[149,1562,1563],{"class":166},"kind",[149,1565,1566],{"class":170}," ===",[149,1568,195],{"class":170},[149,1570,604],{"class":198},[149,1572,202],{"class":170},[149,1574,1575],{"class":170}," &&",[149,1577,371],{"class":177},[149,1579,539],{"class":166},[149,1581,513],{"class":170},[149,1583,1584],{"class":166},"name",[149,1586,513],{"class":170},[149,1588,1438],{"class":162},[149,1590,167],{"class":177},[149,1592,202],{"class":170},[149,1594,1595],{"class":198},"admin:",[149,1597,202],{"class":170},[149,1599,919],{"class":177},[149,1601,1602],{"class":170},"||",[149,1604,925],{"class":166},[149,1606,513],{"class":170},[149,1608,1584],{"class":166},[149,1610,1566],{"class":170},[149,1612,195],{"class":170},[149,1614,1615],{"class":198},"*",[149,1617,202],{"class":170},[149,1619,1465],{"class":177},[149,1621,539],{"class":166},[149,1623,513],{"class":170},[149,1625,1490],{"class":162},[149,1627,167],{"class":177},[149,1629,202],{"class":170},[149,1631,1632],{"class":198},"Admins only",[149,1634,202],{"class":170},[149,1636,220],{"class":177},[149,1638,1640,1642,1644,1646,1648,1650],{"class":151,"line":1639},12,[149,1641,1483],{"class":155},[149,1643,925],{"class":166},[149,1645,513],{"class":170},[149,1647,1472],{"class":166},[149,1649,556],{"class":170},[149,1651,1478],{"class":1477},[149,1653,1655,1657],{"class":151,"line":1654},13,[149,1656,667],{"class":170},[149,1658,220],{"class":177},[149,1660,1662,1664],{"class":151,"line":1661},14,[149,1663,217],{"class":170},[149,1665,220],{"class":166},[125,1667,1668,1670,1671,1674,1675,1677,1678,513],{},[146,1669,253],{}," runs after the cheap checks (reserved key, size, key count) and before the value is stored. A denied write stores and broadcasts nothing. The deny reason comes back to the client in the error acknowledgement, for example ",[146,1672,1673],{},"{ success: false, error: 'Not your key' }",". A denied ",[146,1676,1164],{}," returns ",[146,1679,268],{},[447,1681,1683],{"id":1682},"how-hooks-combine","How hooks combine",[125,1685,1686],{},"Each registered hook runs with its own copy of the context and casts one vote:",[228,1688,1689,1698,1704,1707],{},[231,1690,1691,1029,1694,1697],{},[146,1692,1693],{},"ctx.deny(reason)",[146,1695,1696],{},"ctx.allow = false"," is a deny.",[231,1699,1700,1703],{},[146,1701,1702],{},"ctx.allow = true"," is an allow.",[231,1705,1706],{},"Setting nothing is an abstain.",[231,1708,1709,1710,513],{},"A hook that throws is a deny, with the reason ",[146,1711,1712],{},"Hook error",[125,1714,1715,1716,1718],{},"Any deny wins. Otherwise any allow wins. If every hook abstains (or none is registered), the default applies. So a later hook can never undo an earlier deny, and registration order does not matter. With ",[146,1717,226],{}," and no hooks, everything is denied until you write one.",[447,1720,1722],{"id":1721},"re-checking-joins","Re-checking joins",[125,1724,1725,1727,1728,1730,1731,1733],{},[146,1726,243],{}," runs on every explicit join, not only the first one per connection. Clients join again after a reconnect, so a permission you revoke takes effect then. ",[146,1729,1154],{}," with a ",[146,1732,1158],{}," reuses the allow from the socket's earlier join instead of asking again.",[275,1735,1737],{"id":1736},"presence-and-lock-info","Presence and lock info",[125,1739,257,1740,261,1742,1744,1745,1747,1748,1751],{},[146,1741,260],{},[146,1743,264],{}," are shown to other clients. The ",[146,1746,272],{}," hook decides what is stored and broadcast. The client's value arrives only as ",[146,1749,1750],{},"ctx.clientInfo",", which you should treat as untrusted.",[138,1753,1756],{"className":140,"code":1754,"filename":1755,"language":143,"meta":144,"style":144},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('nuxt-realtime:publicInfo', (ctx) => {\n    const user = ctx.user as { name: string, avatarUrl: string }\n    ctx.info = { name: user.name, avatarUrl: user.avatarUrl }\n  })\n})\n","server\u002Fplugins\u002Frealtime-project.ts",[146,1757,1758,1778,1810,1845,1882,1888],{"__ignoreMap":144},[149,1759,1760,1762,1764,1766,1768,1770,1772,1774,1776],{"class":151,"line":152},[149,1761,156],{"class":155},[149,1763,159],{"class":155},[149,1765,492],{"class":162},[149,1767,167],{"class":166},[149,1769,167],{"class":170},[149,1771,499],{"class":374},[149,1773,384],{"class":170},[149,1775,387],{"class":298},[149,1777,184],{"class":170},[149,1779,1780,1782,1784,1786,1788,1790,1792,1794,1796,1798,1800,1802,1804,1806,1808],{"class":151,"line":174},[149,1781,510],{"class":166},[149,1783,513],{"class":170},[149,1785,516],{"class":166},[149,1787,513],{"class":170},[149,1789,521],{"class":162},[149,1791,167],{"class":177},[149,1793,202],{"class":170},[149,1795,272],{"class":198},[149,1797,202],{"class":170},[149,1799,412],{"class":170},[149,1801,371],{"class":170},[149,1803,539],{"class":374},[149,1805,384],{"class":170},[149,1807,387],{"class":298},[149,1809,184],{"class":170},[149,1811,1812,1814,1816,1818,1820,1822,1824,1826,1828,1830,1832,1834,1836,1839,1841,1843],{"class":151,"line":187},[149,1813,550],{"class":298},[149,1815,568],{"class":166},[149,1817,556],{"class":170},[149,1819,925],{"class":166},[149,1821,513],{"class":170},[149,1823,648],{"class":166},[149,1825,1404],{"class":155},[149,1827,573],{"class":170},[149,1829,585],{"class":177},[149,1831,181],{"class":170},[149,1833,381],{"class":302},[149,1835,412],{"class":170},[149,1837,1838],{"class":177}," avatarUrl",[149,1840,181],{"class":170},[149,1842,381],{"class":302},[149,1844,1415],{"class":170},[149,1846,1847,1849,1851,1853,1855,1857,1859,1861,1863,1865,1867,1869,1871,1873,1875,1877,1880],{"class":151,"line":208},[149,1848,643],{"class":166},[149,1850,513],{"class":170},[149,1852,260],{"class":166},[149,1854,556],{"class":170},[149,1856,573],{"class":170},[149,1858,585],{"class":177},[149,1860,181],{"class":170},[149,1862,568],{"class":166},[149,1864,513],{"class":170},[149,1866,1584],{"class":166},[149,1868,412],{"class":170},[149,1870,1838],{"class":177},[149,1872,181],{"class":170},[149,1874,568],{"class":166},[149,1876,513],{"class":170},[149,1878,1879],{"class":166},"avatarUrl",[149,1881,1415],{"class":170},[149,1883,1884,1886],{"class":151,"line":214},[149,1885,667],{"class":170},[149,1887,220],{"class":177},[149,1889,1890,1892],{"class":151,"line":363},[149,1891,217],{"class":170},[149,1893,220],{"class":166},[138,1895,1897],{"className":140,"code":1896,"language":143,"meta":144,"style":144},"interface ProjectContext {\n  kind: 'presence' | 'lock'\n  room?: string\n  key?: string \u002F\u002F lock key\n  user: unknown\n  connectionId: string\n  socket: Socket\n  clientInfo: unknown\n  info: unknown \u002F\u002F set this\n}\n",[146,1898,1899,1908,1931,1941,1953,1961,1970,1978,1987,2000],{"__ignoreMap":144},[149,1900,1901,1903,1906],{"class":151,"line":152},[149,1902,299],{"class":298},[149,1904,1905],{"class":302}," ProjectContext",[149,1907,184],{"class":170},[149,1909,1910,1913,1915,1917,1920,1922,1924,1926,1929],{"class":151,"line":174},[149,1911,1912],{"class":177},"  kind",[149,1914,181],{"class":170},[149,1916,195],{"class":170},[149,1918,1919],{"class":198},"presence",[149,1921,202],{"class":170},[149,1923,342],{"class":170},[149,1925,195],{"class":170},[149,1927,1928],{"class":198},"lock",[149,1930,350],{"class":170},[149,1932,1933,1936,1938],{"class":151,"line":187},[149,1934,1935],{"class":177},"  room",[149,1937,378],{"class":170},[149,1939,1940],{"class":302}," string\n",[149,1942,1943,1946,1948,1950],{"class":151,"line":208},[149,1944,1945],{"class":177},"  key",[149,1947,378],{"class":170},[149,1949,381],{"class":302},[149,1951,1952],{"class":1293}," \u002F\u002F lock key\n",[149,1954,1955,1957,1959],{"class":151,"line":214},[149,1956,355],{"class":177},[149,1958,181],{"class":170},[149,1960,360],{"class":302},[149,1962,1963,1966,1968],{"class":151,"line":363},[149,1964,1965],{"class":177},"  connectionId",[149,1967,181],{"class":170},[149,1969,1940],{"class":302},[149,1971,1972,1974,1976],{"class":151,"line":393},[149,1973,1254],{"class":177},[149,1975,181],{"class":170},[149,1977,1259],{"class":302},[149,1979,1980,1983,1985],{"class":151,"line":672},[149,1981,1982],{"class":177},"  clientInfo",[149,1984,181],{"class":170},[149,1986,360],{"class":302},[149,1988,1989,1992,1994,1997],{"class":151,"line":1311},[149,1990,1991],{"class":177},"  info",[149,1993,181],{"class":170},[149,1995,1996],{"class":302}," unknown",[149,1998,1999],{"class":1293}," \u002F\u002F set this\n",[149,2001,2002],{"class":151,"line":1317},[149,2003,396],{"class":170},[125,2005,2006,2009,2010,2012,2013,2015,2016,2019,2020,2022,2023,2025],{},[146,2007,2008],{},"ctx.info"," starts as ",[146,2011,268],{}," with ",[146,2014,226],{},", and as ",[146,2017,2018],{},"clientInfo"," otherwise. Unlike the gates, these hooks run in registration order on one shared context, and each can change what the previous one set. If a hook throws, ",[146,2021,260],{}," becomes ",[146,2024,268],{},". The projected value is what gets stored, so late joiners see the same data as live broadcasts.",[125,2027,2028,2029,2032,2033,2036,2037,425,2039,513],{},"Not projected: ",[146,2030,2031],{},"lock:release"," ",[146,2034,2035],{},"meta",", state values and event data are still client data. Gate them with ",[146,2038,253],{},[146,2040,250],{},[275,2042,2044],{"id":2043},"extending-the-server","Extending the server",[125,2046,2047],{},"Server code can reuse the module's own checks and write to realtime state. Both functions are Nitro auto-imports, also inside server plugins of other modules.",[447,2049,2051],{"id":2050},"guard","guard()",[125,2053,2054,2055,2057],{},"Use ",[146,2056,2051],{}," in a custom socket event to apply what the built-in handlers apply: the socket's rate limit, key validity, size limit, the wait for identification, and the matching gate hook. It returns a decision and leaves the work to your handler.",[138,2059,2061],{"className":140,"code":2060,"language":143,"meta":144,"style":144},"function guard(\n  socket: Socket,\n  options: { kind: 'write' | 'publish' | 'subscribe' | 'join', name: string, data?: unknown },\n): Promise\u003C{ allowed: boolean, reason?: string }>\n",[146,2062,2063,2074,2085,2153],{"__ignoreMap":144},[149,2064,2065,2068,2071],{"class":151,"line":152},[149,2066,2067],{"class":298},"function",[149,2069,2070],{"class":162}," guard",[149,2072,2073],{"class":170},"(\n",[149,2075,2076,2078,2080,2083],{"class":151,"line":174},[149,2077,1254],{"class":374},[149,2079,181],{"class":170},[149,2081,2082],{"class":302}," Socket",[149,2084,205],{"class":170},[149,2086,2087,2090,2092,2094,2097,2099,2101,2104,2106,2108,2110,2113,2115,2117,2119,2122,2124,2126,2128,2131,2133,2135,2137,2139,2141,2143,2146,2148,2150],{"class":151,"line":187},[149,2088,2089],{"class":374},"  options",[149,2091,181],{"class":170},[149,2093,573],{"class":170},[149,2095,2096],{"class":177}," kind",[149,2098,181],{"class":170},[149,2100,195],{"class":170},[149,2102,2103],{"class":198},"write",[149,2105,202],{"class":170},[149,2107,342],{"class":170},[149,2109,195],{"class":170},[149,2111,2112],{"class":198},"publish",[149,2114,202],{"class":170},[149,2116,342],{"class":170},[149,2118,195],{"class":170},[149,2120,2121],{"class":198},"subscribe",[149,2123,202],{"class":170},[149,2125,342],{"class":170},[149,2127,195],{"class":170},[149,2129,2130],{"class":198},"join",[149,2132,202],{"class":170},[149,2134,412],{"class":170},[149,2136,585],{"class":177},[149,2138,181],{"class":170},[149,2140,381],{"class":302},[149,2142,412],{"class":170},[149,2144,2145],{"class":177}," data",[149,2147,378],{"class":170},[149,2149,1996],{"class":302},[149,2151,2152],{"class":170}," },\n",[149,2154,2155,2158,2161,2163,2166,2168,2170,2172,2175,2177,2179],{"class":151,"line":208},[149,2156,2157],{"class":170},"):",[149,2159,2160],{"class":302}," Promise",[149,2162,565],{"class":170},[149,2164,2165],{"class":177}," allowed",[149,2167,181],{"class":170},[149,2169,1290],{"class":302},[149,2171,412],{"class":170},[149,2173,2174],{"class":177}," reason",[149,2176,378],{"class":170},[149,2178,381],{"class":302},[149,2180,2181],{"class":170}," }>\n",[1087,2183,2184,2195],{},[1090,2185,2186],{},[1093,2187,2188,2192],{},[1096,2189,2190],{},[146,2191,1563],{},[1096,2193,2194],{},"Gate hook it runs",[1106,2196,2197,2213,2229,2242],{},[1093,2198,2199,2203],{},[1111,2200,2201],{},[146,2202,2103],{},[1111,2204,2205,371,2207,2209,2210,2212],{},[146,2206,253],{},[146,2208,1584],{}," is the key, ",[146,2211,657],{}," the value)",[1093,2214,2215,2219],{},[1111,2216,2217],{},[146,2218,2112],{},[1111,2220,2221,371,2223,2225,2226,2228],{},[146,2222,250],{},[146,2224,1584],{}," is the channel, ",[146,2227,657],{}," the payload)",[1093,2230,2231,2235],{},[1111,2232,2233],{},[146,2234,2121],{},[1111,2236,2237,2012,2239],{},[146,2238,247],{},[146,2240,2241],{},"kind: 'event'",[1093,2243,2244,2248],{},[1111,2245,2246],{},[146,2247,2130],{},[1111,2249,2250,371,2252,2254],{},[146,2251,243],{},[146,2253,1584],{}," is the room id)",[125,2256,2257,2259],{},[146,2258,2051],{}," does not check room capacity.",[447,2261,2263],{"id":2262},"userealtimeserver","useRealtimeServer()",[125,2265,2266],{},"Trusted server-side access, with no gate hooks:",[138,2268,2270],{"className":140,"code":2269,"language":143,"meta":144,"style":144},"function useRealtimeServer(): {\n  publish: (channel: string, data?: unknown) => Promise\u003Cvoid>\n  getState: \u003CT = unknown>(key: string) => Promise\u003CT | null>\n  setState: (key: string, value: StorageValue) => Promise\u003Cvoid>\n}\n",[146,2271,2272,2284,2323,2366,2403],{"__ignoreMap":144},[149,2273,2274,2276,2279,2282],{"class":151,"line":152},[149,2275,2067],{"class":298},[149,2277,2278],{"class":162}," useRealtimeServer",[149,2280,2281],{"class":170},"():",[149,2283,184],{"class":170},[149,2285,2286,2289,2291,2293,2296,2298,2300,2302,2304,2306,2308,2310,2312,2314,2317,2320],{"class":151,"line":174},[149,2287,2288],{"class":177},"  publish",[149,2290,181],{"class":170},[149,2292,371],{"class":170},[149,2294,2295],{"class":374},"channel",[149,2297,181],{"class":170},[149,2299,381],{"class":302},[149,2301,412],{"class":170},[149,2303,2145],{"class":374},[149,2305,378],{"class":170},[149,2307,1996],{"class":302},[149,2309,384],{"class":170},[149,2311,387],{"class":298},[149,2313,2160],{"class":302},[149,2315,2316],{"class":170},"\u003C",[149,2318,2319],{"class":302},"void",[149,2321,2322],{"class":170},">\n",[149,2324,2325,2328,2330,2333,2336,2338,2340,2343,2345,2347,2349,2351,2353,2355,2357,2359,2361,2364],{"class":151,"line":187},[149,2326,2327],{"class":177},"  getState",[149,2329,181],{"class":170},[149,2331,2332],{"class":170}," \u003C",[149,2334,2335],{"class":302},"T",[149,2337,556],{"class":170},[149,2339,1996],{"class":302},[149,2341,2342],{"class":170},">(",[149,2344,1433],{"class":374},[149,2346,181],{"class":170},[149,2348,381],{"class":302},[149,2350,384],{"class":170},[149,2352,387],{"class":298},[149,2354,2160],{"class":302},[149,2356,2316],{"class":170},[149,2358,2335],{"class":302},[149,2360,342],{"class":170},[149,2362,2363],{"class":302}," null",[149,2365,2322],{"class":170},[149,2367,2368,2371,2373,2375,2377,2379,2381,2383,2386,2388,2391,2393,2395,2397,2399,2401],{"class":151,"line":208},[149,2369,2370],{"class":177},"  setState",[149,2372,181],{"class":170},[149,2374,371],{"class":170},[149,2376,1433],{"class":374},[149,2378,181],{"class":170},[149,2380,381],{"class":302},[149,2382,412],{"class":170},[149,2384,2385],{"class":374}," value",[149,2387,181],{"class":170},[149,2389,2390],{"class":302}," StorageValue",[149,2392,384],{"class":170},[149,2394,387],{"class":298},[149,2396,2160],{"class":302},[149,2398,2316],{"class":170},[149,2400,2319],{"class":302},[149,2402,2322],{"class":170},[149,2404,2405],{"class":151,"line":214},[149,2406,396],{"class":170},[125,2408,2409,2410,2413],{},"Keys are still validated: reserved (",[146,2411,2412],{},"_","-prefixed) and malformed keys throw. With Redis, writes and publishes reach clients on other instances. It throws if called while Nitro plugins are still loading, so call it from a request handler or a hook.",[138,2415,2418],{"className":140,"code":2416,"filename":2417,"language":143,"meta":144,"style":144},"export default defineEventHandler(async (event) => {\n  const { text } = await readBody(event)\n  await useRealtimeServer().publish('announcements', text)\n  return { ok: true }\n})\n","server\u002Fapi\u002Fannounce.post.ts",[146,2419,2420,2444,2469,2498,2515],{"__ignoreMap":144},[149,2421,2422,2424,2426,2429,2431,2434,2436,2438,2440,2442],{"class":151,"line":152},[149,2423,156],{"class":155},[149,2425,159],{"class":155},[149,2427,2428],{"class":162}," defineEventHandler",[149,2430,167],{"class":166},[149,2432,2433],{"class":298},"async",[149,2435,371],{"class":170},[149,2437,604],{"class":374},[149,2439,384],{"class":170},[149,2441,387],{"class":298},[149,2443,184],{"class":170},[149,2445,2446,2449,2451,2454,2456,2458,2460,2463,2465,2467],{"class":151,"line":174},[149,2447,2448],{"class":298},"  const",[149,2450,573],{"class":170},[149,2452,2453],{"class":166}," text",[149,2455,592],{"class":170},[149,2457,556],{"class":170},[149,2459,559],{"class":155},[149,2461,2462],{"class":162}," readBody",[149,2464,167],{"class":177},[149,2466,604],{"class":166},[149,2468,220],{"class":177},[149,2470,2471,2474,2476,2479,2481,2483,2485,2487,2490,2492,2494,2496],{"class":151,"line":187},[149,2472,2473],{"class":155},"  await",[149,2475,2278],{"class":162},[149,2477,2478],{"class":177},"()",[149,2480,513],{"class":170},[149,2482,2112],{"class":162},[149,2484,167],{"class":177},[149,2486,202],{"class":170},[149,2488,2489],{"class":198},"announcements",[149,2491,202],{"class":170},[149,2493,412],{"class":170},[149,2495,2453],{"class":166},[149,2497,220],{"class":177},[149,2499,2500,2503,2505,2508,2510,2513],{"class":151,"line":208},[149,2501,2502],{"class":155},"  return",[149,2504,573],{"class":170},[149,2506,2507],{"class":177}," ok",[149,2509,181],{"class":170},[149,2511,2512],{"class":1477}," true",[149,2514,1415],{"class":170},[149,2516,2517,2519],{"class":151,"line":214},[149,2518,217],{"class":170},[149,2520,220],{"class":166},[447,2522,2524],{"id":2523},"after-hooks","After hooks",[125,2526,2527,425,2530,2533,2534,181],{},[146,2528,2529],{},"nuxt-realtime:afterWrite",[146,2531,2532],{},"nuxt-realtime:afterPublish"," fire after a write or publish succeeded, from clients and from ",[146,2535,2263],{},[138,2537,2539],{"className":140,"code":2538,"language":143,"meta":144,"style":144},"interface AfterWriteContext {\n  key: string\n  value: unknown\n  connectionId?: string \u002F\u002F client source only\n  socket?: Socket \u002F\u002F client source only\n  user?: unknown \u002F\u002F client source only\n  source: 'client' | 'server'\n}\n\u002F\u002F afterPublish has { channel, data } instead of { key, value }\n",[146,2540,2541,2550,2558,2567,2578,2588,2598,2621,2625],{"__ignoreMap":144},[149,2542,2543,2545,2548],{"class":151,"line":152},[149,2544,299],{"class":298},[149,2546,2547],{"class":302}," AfterWriteContext",[149,2549,184],{"class":170},[149,2551,2552,2554,2556],{"class":151,"line":174},[149,2553,1945],{"class":177},[149,2555,181],{"class":170},[149,2557,1940],{"class":302},[149,2559,2560,2563,2565],{"class":151,"line":187},[149,2561,2562],{"class":177},"  value",[149,2564,181],{"class":170},[149,2566,360],{"class":302},[149,2568,2569,2571,2573,2575],{"class":151,"line":208},[149,2570,1965],{"class":177},[149,2572,378],{"class":170},[149,2574,381],{"class":302},[149,2576,2577],{"class":1293}," \u002F\u002F client source only\n",[149,2579,2580,2582,2584,2586],{"class":151,"line":214},[149,2581,1254],{"class":177},[149,2583,378],{"class":170},[149,2585,2082],{"class":302},[149,2587,2577],{"class":1293},[149,2589,2590,2592,2594,2596],{"class":151,"line":363},[149,2591,355],{"class":177},[149,2593,378],{"class":170},[149,2595,1996],{"class":302},[149,2597,2577],{"class":1293},[149,2599,2600,2603,2605,2607,2610,2612,2614,2616,2619],{"class":151,"line":393},[149,2601,2602],{"class":177},"  source",[149,2604,181],{"class":170},[149,2606,195],{"class":170},[149,2608,2609],{"class":198},"client",[149,2611,202],{"class":170},[149,2613,342],{"class":170},[149,2615,195],{"class":170},[149,2617,2618],{"class":198},"server",[149,2620,350],{"class":170},[149,2622,2623],{"class":151,"line":672},[149,2624,396],{"class":170},[149,2626,2627],{"class":151,"line":1311},[149,2628,2629],{"class":1293},"\u002F\u002F afterPublish has { channel, data } instead of { key, value }\n",[125,2631,2632],{},"They never fire for a denied or failed call. They are not awaited before the client's acknowledgement, and a throwing hook is only logged. Use them for audit logs, history and webhooks.",[275,2634,2636],{"id":2635},"writing-a-plugin-package","Writing a plugin package",[125,2638,2639,2640,425,2642,2644,2645,513],{},"A package that extends Nuxt Realtime is a Nuxt module. The module adds a Nitro server plugin. The plugin registers hooks and uses ",[146,2641,2051],{},[146,2643,2263],{},". Its configuration goes through the package's own module options, not through ",[146,2646,2647],{},"nuxtRealtime",[125,2649,2650,2651,2654,2655,2658,2659,2661,2662,2664,2665,181],{},"The playground has a small example in ",[146,2652,2653],{},"playground\u002Fserver\u002Fplugins\u002Frealtime-max-payload.ts",". It adds a custom ",[146,2656,2657],{},"announce"," event that gets the same rate limit, size limit and ",[146,2660,250],{}," check as ",[146,2663,1183],{},", and logs through ",[146,2666,2667],{},"afterPublish",[138,2669,2671],{"className":140,"code":2670,"filename":2653,"language":143,"meta":144,"style":144},"import type { Server } from 'socket.io'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('nuxt-realtime:io', (io: Server) => {\n    io.on('connection', (socket) => {\n      socket.on('announce', async (text: string, ack?: (r: unknown) => void) => {\n        const verdict = await guard(socket, { kind: 'publish', name: 'announcements', data: text })\n        if (!verdict.allowed) return ack?.({ success: false, error: verdict.reason })\n        await useRealtimeServer().publish('announcements', text)\n        ack?.({ success: true })\n      })\n    })\n  })\n\n  nitroApp.hooks.hook('nuxt-realtime:afterPublish', (ctx) => {\n    console.log(`[realtime] ${ctx.source} published on ${ctx.channel}`)\n  })\n})\n",[146,2672,2673,2698,2702,2722,2759,2790,2849,2905,2962,2989,3010,3017,3023,3029,3033,3066,3111,3118],{"__ignoreMap":144},[149,2674,2675,2678,2681,2683,2686,2688,2691,2693,2696],{"class":151,"line":152},[149,2676,2677],{"class":155},"import",[149,2679,2680],{"class":155}," type",[149,2682,573],{"class":170},[149,2684,2685],{"class":166}," Server",[149,2687,592],{"class":170},[149,2689,2690],{"class":155}," from",[149,2692,195],{"class":170},[149,2694,2695],{"class":198},"socket.io",[149,2697,350],{"class":170},[149,2699,2700],{"class":151,"line":174},[149,2701,1513],{"emptyLinePlaceholder":1512},[149,2703,2704,2706,2708,2710,2712,2714,2716,2718,2720],{"class":151,"line":187},[149,2705,156],{"class":155},[149,2707,159],{"class":155},[149,2709,492],{"class":162},[149,2711,167],{"class":166},[149,2713,167],{"class":170},[149,2715,499],{"class":374},[149,2717,384],{"class":170},[149,2719,387],{"class":298},[149,2721,184],{"class":170},[149,2723,2724,2726,2728,2730,2732,2734,2736,2738,2740,2742,2744,2746,2749,2751,2753,2755,2757],{"class":151,"line":208},[149,2725,510],{"class":166},[149,2727,513],{"class":170},[149,2729,516],{"class":166},[149,2731,513],{"class":170},[149,2733,521],{"class":162},[149,2735,167],{"class":177},[149,2737,202],{"class":170},[149,2739,1010],{"class":198},[149,2741,202],{"class":170},[149,2743,412],{"class":170},[149,2745,371],{"class":170},[149,2747,2748],{"class":374},"io",[149,2750,181],{"class":170},[149,2752,2685],{"class":302},[149,2754,384],{"class":170},[149,2756,387],{"class":298},[149,2758,184],{"class":170},[149,2760,2761,2764,2766,2769,2771,2773,2776,2778,2780,2782,2784,2786,2788],{"class":151,"line":214},[149,2762,2763],{"class":166},"    io",[149,2765,513],{"class":170},[149,2767,2768],{"class":162},"on",[149,2770,167],{"class":177},[149,2772,202],{"class":170},[149,2774,2775],{"class":198},"connection",[149,2777,202],{"class":170},[149,2779,412],{"class":170},[149,2781,371],{"class":170},[149,2783,1226],{"class":374},[149,2785,384],{"class":170},[149,2787,387],{"class":298},[149,2789,184],{"class":170},[149,2791,2792,2795,2797,2799,2801,2803,2805,2807,2809,2811,2813,2816,2818,2820,2822,2825,2827,2829,2832,2834,2836,2838,2840,2843,2845,2847],{"class":151,"line":363},[149,2793,2794],{"class":166},"      socket",[149,2796,513],{"class":170},[149,2798,2768],{"class":162},[149,2800,167],{"class":177},[149,2802,202],{"class":170},[149,2804,2657],{"class":198},[149,2806,202],{"class":170},[149,2808,412],{"class":170},[149,2810,534],{"class":298},[149,2812,371],{"class":170},[149,2814,2815],{"class":374},"text",[149,2817,181],{"class":170},[149,2819,381],{"class":302},[149,2821,412],{"class":170},[149,2823,2824],{"class":162}," ack",[149,2826,378],{"class":170},[149,2828,371],{"class":170},[149,2830,2831],{"class":374},"r",[149,2833,181],{"class":170},[149,2835,1996],{"class":302},[149,2837,384],{"class":170},[149,2839,387],{"class":298},[149,2841,2842],{"class":302}," void",[149,2844,384],{"class":170},[149,2846,387],{"class":298},[149,2848,184],{"class":170},[149,2850,2851,2854,2857,2859,2861,2863,2865,2867,2869,2871,2873,2875,2877,2879,2881,2883,2885,2887,2889,2891,2893,2895,2897,2899,2901,2903],{"class":151,"line":393},[149,2852,2853],{"class":298},"        const",[149,2855,2856],{"class":166}," verdict",[149,2858,556],{"class":170},[149,2860,559],{"class":155},[149,2862,2070],{"class":162},[149,2864,167],{"class":177},[149,2866,1226],{"class":166},[149,2868,412],{"class":170},[149,2870,573],{"class":170},[149,2872,2096],{"class":177},[149,2874,181],{"class":170},[149,2876,195],{"class":170},[149,2878,2112],{"class":198},[149,2880,202],{"class":170},[149,2882,412],{"class":170},[149,2884,585],{"class":177},[149,2886,181],{"class":170},[149,2888,195],{"class":170},[149,2890,2489],{"class":198},[149,2892,202],{"class":170},[149,2894,412],{"class":170},[149,2896,2145],{"class":177},[149,2898,181],{"class":170},[149,2900,2453],{"class":166},[149,2902,592],{"class":170},[149,2904,220],{"class":177},[149,2906,2907,2910,2912,2915,2918,2920,2923,2925,2927,2929,2932,2934,2937,2940,2942,2945,2947,2950,2952,2954,2956,2958,2960],{"class":151,"line":672},[149,2908,2909],{"class":155},"        if",[149,2911,371],{"class":177},[149,2913,2914],{"class":170},"!",[149,2916,2917],{"class":166},"verdict",[149,2919,513],{"class":170},[149,2921,2922],{"class":166},"allowed",[149,2924,919],{"class":177},[149,2926,922],{"class":155},[149,2928,2824],{"class":162},[149,2930,2931],{"class":170},"?.",[149,2933,167],{"class":177},[149,2935,2936],{"class":170},"{",[149,2938,2939],{"class":177}," success",[149,2941,181],{"class":170},[149,2943,2944],{"class":1477}," false",[149,2946,412],{"class":170},[149,2948,2949],{"class":177}," error",[149,2951,181],{"class":170},[149,2953,2856],{"class":166},[149,2955,513],{"class":170},[149,2957,375],{"class":166},[149,2959,592],{"class":170},[149,2961,220],{"class":177},[149,2963,2964,2967,2969,2971,2973,2975,2977,2979,2981,2983,2985,2987],{"class":151,"line":1311},[149,2965,2966],{"class":155},"        await",[149,2968,2278],{"class":162},[149,2970,2478],{"class":177},[149,2972,513],{"class":170},[149,2974,2112],{"class":162},[149,2976,167],{"class":177},[149,2978,202],{"class":170},[149,2980,2489],{"class":198},[149,2982,202],{"class":170},[149,2984,412],{"class":170},[149,2986,2453],{"class":166},[149,2988,220],{"class":177},[149,2990,2991,2994,2996,2998,3000,3002,3004,3006,3008],{"class":151,"line":1317},[149,2992,2993],{"class":162},"        ack",[149,2995,2931],{"class":170},[149,2997,167],{"class":177},[149,2999,2936],{"class":170},[149,3001,2939],{"class":177},[149,3003,181],{"class":170},[149,3005,2512],{"class":1477},[149,3007,592],{"class":170},[149,3009,220],{"class":177},[149,3011,3012,3015],{"class":151,"line":1326},[149,3013,3014],{"class":170},"      }",[149,3016,220],{"class":177},[149,3018,3019,3021],{"class":151,"line":1639},[149,3020,636],{"class":170},[149,3022,220],{"class":177},[149,3024,3025,3027],{"class":151,"line":1654},[149,3026,667],{"class":170},[149,3028,220],{"class":177},[149,3030,3031],{"class":151,"line":1661},[149,3032,1513],{"emptyLinePlaceholder":1512},[149,3034,3036,3038,3040,3042,3044,3046,3048,3050,3052,3054,3056,3058,3060,3062,3064],{"class":151,"line":3035},15,[149,3037,510],{"class":166},[149,3039,513],{"class":170},[149,3041,516],{"class":166},[149,3043,513],{"class":170},[149,3045,521],{"class":162},[149,3047,167],{"class":177},[149,3049,202],{"class":170},[149,3051,2532],{"class":198},[149,3053,202],{"class":170},[149,3055,412],{"class":170},[149,3057,371],{"class":170},[149,3059,539],{"class":374},[149,3061,384],{"class":170},[149,3063,387],{"class":298},[149,3065,184],{"class":170},[149,3067,3069,3072,3074,3077,3079,3081,3084,3086,3088,3090,3093,3095,3098,3100,3102,3104,3106,3109],{"class":151,"line":3068},16,[149,3070,3071],{"class":166},"    console",[149,3073,513],{"class":170},[149,3075,3076],{"class":162},"log",[149,3078,167],{"class":177},[149,3080,1443],{"class":170},[149,3082,3083],{"class":198},"[realtime] ",[149,3085,1449],{"class":170},[149,3087,539],{"class":166},[149,3089,513],{"class":170},[149,3091,3092],{"class":166},"source",[149,3094,217],{"class":170},[149,3096,3097],{"class":198}," published on ",[149,3099,1449],{"class":170},[149,3101,539],{"class":166},[149,3103,513],{"class":170},[149,3105,2295],{"class":166},[149,3107,3108],{"class":170},"}`",[149,3110,220],{"class":177},[149,3112,3114,3116],{"class":151,"line":3113},17,[149,3115,667],{"class":170},[149,3117,220],{"class":177},[149,3119,3121,3123],{"class":151,"line":3120},18,[149,3122,217],{"class":170},[149,3124,220],{"class":166},[125,3126,3127],{},"As a package, wrap it in a module that passes its options to the plugin through runtime config:",[138,3129,3132],{"className":140,"code":3130,"filename":3131,"language":143,"meta":144,"style":144},"import { defineNuxtModule, createResolver, addServerPlugin } from '@nuxt\u002Fkit'\n\nexport interface ModuleOptions {\n  maxLength?: number\n}\n\nexport default defineNuxtModule\u003CModuleOptions>({\n  meta: { name: 'realtime-announcements', configKey: 'realtimeAnnouncements' },\n  defaults: { maxLength: 500 },\n  setup(options, nuxt) {\n    const { resolve } = createResolver(import.meta.url)\n    nuxt.options.runtimeConfig.realtimeAnnouncements = { maxLength: options.maxLength }\n    addServerPlugin(resolve('.\u002Fruntime\u002Fserver\u002Fplugins\u002Fannounce'))\n  },\n})\n","src\u002Fmodule.ts",[146,3133,3134,3164,3168,3180,3190,3194,3198,3218,3254,3274,3293,3323,3359,3381,3385],{"__ignoreMap":144},[149,3135,3136,3138,3140,3143,3145,3148,3150,3153,3155,3157,3159,3162],{"class":151,"line":152},[149,3137,2677],{"class":155},[149,3139,573],{"class":170},[149,3141,3142],{"class":166}," defineNuxtModule",[149,3144,412],{"class":170},[149,3146,3147],{"class":166}," createResolver",[149,3149,412],{"class":170},[149,3151,3152],{"class":166}," addServerPlugin",[149,3154,592],{"class":170},[149,3156,2690],{"class":155},[149,3158,195],{"class":170},[149,3160,3161],{"class":198},"@nuxt\u002Fkit",[149,3163,350],{"class":170},[149,3165,3166],{"class":151,"line":174},[149,3167,1513],{"emptyLinePlaceholder":1512},[149,3169,3170,3172,3175,3178],{"class":151,"line":187},[149,3171,156],{"class":155},[149,3173,3174],{"class":298}," interface",[149,3176,3177],{"class":302}," ModuleOptions",[149,3179,184],{"class":170},[149,3181,3182,3185,3187],{"class":151,"line":208},[149,3183,3184],{"class":177},"  maxLength",[149,3186,378],{"class":170},[149,3188,3189],{"class":302}," number\n",[149,3191,3192],{"class":151,"line":214},[149,3193,396],{"class":170},[149,3195,3196],{"class":151,"line":363},[149,3197,1513],{"emptyLinePlaceholder":1512},[149,3199,3200,3202,3204,3206,3208,3211,3214,3216],{"class":151,"line":393},[149,3201,156],{"class":155},[149,3203,159],{"class":155},[149,3205,3142],{"class":162},[149,3207,2316],{"class":170},[149,3209,3210],{"class":302},"ModuleOptions",[149,3212,3213],{"class":170},">",[149,3215,167],{"class":166},[149,3217,171],{"class":170},[149,3219,3220,3223,3225,3227,3229,3231,3233,3236,3238,3240,3243,3245,3247,3250,3252],{"class":151,"line":672},[149,3221,3222],{"class":177},"  meta",[149,3224,181],{"class":170},[149,3226,573],{"class":170},[149,3228,585],{"class":177},[149,3230,181],{"class":170},[149,3232,195],{"class":170},[149,3234,3235],{"class":198},"realtime-announcements",[149,3237,202],{"class":170},[149,3239,412],{"class":170},[149,3241,3242],{"class":177}," configKey",[149,3244,181],{"class":170},[149,3246,195],{"class":170},[149,3248,3249],{"class":198},"realtimeAnnouncements",[149,3251,202],{"class":170},[149,3253,2152],{"class":170},[149,3255,3256,3259,3261,3263,3266,3268,3272],{"class":151,"line":1311},[149,3257,3258],{"class":177},"  defaults",[149,3260,181],{"class":170},[149,3262,573],{"class":170},[149,3264,3265],{"class":177}," maxLength",[149,3267,181],{"class":170},[149,3269,3271],{"class":3270},"sbssI"," 500",[149,3273,2152],{"class":170},[149,3275,3276,3279,3281,3284,3286,3289,3291],{"class":151,"line":1317},[149,3277,3278],{"class":177},"  setup",[149,3280,167],{"class":170},[149,3282,3283],{"class":374},"options",[149,3285,412],{"class":170},[149,3287,3288],{"class":374}," nuxt",[149,3290,384],{"class":170},[149,3292,184],{"class":170},[149,3294,3295,3297,3299,3302,3304,3306,3308,3310,3312,3314,3316,3318,3321],{"class":151,"line":1326},[149,3296,550],{"class":298},[149,3298,573],{"class":170},[149,3300,3301],{"class":166}," resolve",[149,3303,592],{"class":170},[149,3305,556],{"class":170},[149,3307,3147],{"class":162},[149,3309,167],{"class":177},[149,3311,2677],{"class":155},[149,3313,513],{"class":170},[149,3315,2035],{"class":166},[149,3317,513],{"class":170},[149,3319,3320],{"class":166},"url",[149,3322,220],{"class":177},[149,3324,3325,3328,3330,3332,3334,3337,3339,3341,3343,3345,3347,3349,3352,3354,3357],{"class":151,"line":1639},[149,3326,3327],{"class":166},"    nuxt",[149,3329,513],{"class":170},[149,3331,3283],{"class":166},[149,3333,513],{"class":170},[149,3335,3336],{"class":166},"runtimeConfig",[149,3338,513],{"class":170},[149,3340,3249],{"class":166},[149,3342,556],{"class":170},[149,3344,573],{"class":170},[149,3346,3265],{"class":177},[149,3348,181],{"class":170},[149,3350,3351],{"class":166}," options",[149,3353,513],{"class":170},[149,3355,3356],{"class":166},"maxLength",[149,3358,1415],{"class":170},[149,3360,3361,3364,3366,3369,3371,3373,3376,3378],{"class":151,"line":1654},[149,3362,3363],{"class":162},"    addServerPlugin",[149,3365,167],{"class":177},[149,3367,3368],{"class":162},"resolve",[149,3370,167],{"class":177},[149,3372,202],{"class":170},[149,3374,3375],{"class":198},".\u002Fruntime\u002Fserver\u002Fplugins\u002Fannounce",[149,3377,202],{"class":170},[149,3379,3380],{"class":177},"))\n",[149,3382,3383],{"class":151,"line":1661},[149,3384,211],{"class":170},[149,3386,3387,3389],{"class":151,"line":3035},[149,3388,217],{"class":170},[149,3390,220],{"class":166},[138,3392,3395],{"className":140,"code":3393,"filename":3394,"language":143,"meta":144,"style":144},"export default defineNitroPlugin((nitroApp) => {\n  const { maxLength } = useRuntimeConfig().realtimeAnnouncements as { maxLength: number }\n  nitroApp.hooks.hook('nuxt-realtime:io', (io) => {\n    io.on('connection', (socket) => {\n      socket.on('announce', async (text: string, ack?: (r: unknown) => void) => {\n        if (typeof text !== 'string' || text.length > maxLength) return ack?.({ success: false, error: 'Too long' })\n        const verdict = await guard(socket, { kind: 'publish', name: 'announcements', data: text })\n        if (!verdict.allowed) return ack?.({ success: false, error: verdict.reason })\n        await useRealtimeServer().publish('announcements', text)\n        ack?.({ success: true })\n      })\n    })\n  })\n})\n","src\u002Fruntime\u002Fserver\u002Fplugins\u002Fannounce.ts",[146,3396,3397,3417,3451,3483,3511,3565,3633,3687,3735,3761,3781,3787,3793,3799],{"__ignoreMap":144},[149,3398,3399,3401,3403,3405,3407,3409,3411,3413,3415],{"class":151,"line":152},[149,3400,156],{"class":155},[149,3402,159],{"class":155},[149,3404,492],{"class":162},[149,3406,167],{"class":166},[149,3408,167],{"class":170},[149,3410,499],{"class":374},[149,3412,384],{"class":170},[149,3414,387],{"class":298},[149,3416,184],{"class":170},[149,3418,3419,3421,3423,3425,3427,3429,3432,3434,3436,3438,3440,3442,3444,3446,3449],{"class":151,"line":174},[149,3420,2448],{"class":298},[149,3422,573],{"class":170},[149,3424,3265],{"class":166},[149,3426,592],{"class":170},[149,3428,556],{"class":170},[149,3430,3431],{"class":162}," useRuntimeConfig",[149,3433,2478],{"class":177},[149,3435,513],{"class":170},[149,3437,3249],{"class":166},[149,3439,1404],{"class":155},[149,3441,573],{"class":170},[149,3443,3265],{"class":177},[149,3445,181],{"class":170},[149,3447,3448],{"class":302}," number",[149,3450,1415],{"class":170},[149,3452,3453,3455,3457,3459,3461,3463,3465,3467,3469,3471,3473,3475,3477,3479,3481],{"class":151,"line":187},[149,3454,510],{"class":166},[149,3456,513],{"class":170},[149,3458,516],{"class":166},[149,3460,513],{"class":170},[149,3462,521],{"class":162},[149,3464,167],{"class":177},[149,3466,202],{"class":170},[149,3468,1010],{"class":198},[149,3470,202],{"class":170},[149,3472,412],{"class":170},[149,3474,371],{"class":170},[149,3476,2748],{"class":374},[149,3478,384],{"class":170},[149,3480,387],{"class":298},[149,3482,184],{"class":170},[149,3484,3485,3487,3489,3491,3493,3495,3497,3499,3501,3503,3505,3507,3509],{"class":151,"line":208},[149,3486,2763],{"class":166},[149,3488,513],{"class":170},[149,3490,2768],{"class":162},[149,3492,167],{"class":177},[149,3494,202],{"class":170},[149,3496,2775],{"class":198},[149,3498,202],{"class":170},[149,3500,412],{"class":170},[149,3502,371],{"class":170},[149,3504,1226],{"class":374},[149,3506,384],{"class":170},[149,3508,387],{"class":298},[149,3510,184],{"class":170},[149,3512,3513,3515,3517,3519,3521,3523,3525,3527,3529,3531,3533,3535,3537,3539,3541,3543,3545,3547,3549,3551,3553,3555,3557,3559,3561,3563],{"class":151,"line":214},[149,3514,2794],{"class":166},[149,3516,513],{"class":170},[149,3518,2768],{"class":162},[149,3520,167],{"class":177},[149,3522,202],{"class":170},[149,3524,2657],{"class":198},[149,3526,202],{"class":170},[149,3528,412],{"class":170},[149,3530,534],{"class":298},[149,3532,371],{"class":170},[149,3534,2815],{"class":374},[149,3536,181],{"class":170},[149,3538,381],{"class":302},[149,3540,412],{"class":170},[149,3542,2824],{"class":162},[149,3544,378],{"class":170},[149,3546,371],{"class":170},[149,3548,2831],{"class":374},[149,3550,181],{"class":170},[149,3552,1996],{"class":302},[149,3554,384],{"class":170},[149,3556,387],{"class":298},[149,3558,2842],{"class":302},[149,3560,384],{"class":170},[149,3562,387],{"class":298},[149,3564,184],{"class":170},[149,3566,3567,3569,3571,3573,3575,3577,3579,3581,3583,3586,3588,3590,3593,3596,3598,3600,3602,3604,3606,3608,3610,3612,3614,3616,3618,3620,3622,3624,3627,3629,3631],{"class":151,"line":363},[149,3568,2909],{"class":155},[149,3570,371],{"class":177},[149,3572,904],{"class":170},[149,3574,2453],{"class":166},[149,3576,909],{"class":170},[149,3578,195],{"class":170},[149,3580,914],{"class":198},[149,3582,202],{"class":170},[149,3584,3585],{"class":170}," ||",[149,3587,2453],{"class":166},[149,3589,513],{"class":170},[149,3591,3592],{"class":166},"length",[149,3594,3595],{"class":170}," >",[149,3597,3265],{"class":166},[149,3599,919],{"class":177},[149,3601,922],{"class":155},[149,3603,2824],{"class":162},[149,3605,2931],{"class":170},[149,3607,167],{"class":177},[149,3609,2936],{"class":170},[149,3611,2939],{"class":177},[149,3613,181],{"class":170},[149,3615,2944],{"class":1477},[149,3617,412],{"class":170},[149,3619,2949],{"class":177},[149,3621,181],{"class":170},[149,3623,195],{"class":170},[149,3625,3626],{"class":198},"Too long",[149,3628,202],{"class":170},[149,3630,592],{"class":170},[149,3632,220],{"class":177},[149,3634,3635,3637,3639,3641,3643,3645,3647,3649,3651,3653,3655,3657,3659,3661,3663,3665,3667,3669,3671,3673,3675,3677,3679,3681,3683,3685],{"class":151,"line":393},[149,3636,2853],{"class":298},[149,3638,2856],{"class":166},[149,3640,556],{"class":170},[149,3642,559],{"class":155},[149,3644,2070],{"class":162},[149,3646,167],{"class":177},[149,3648,1226],{"class":166},[149,3650,412],{"class":170},[149,3652,573],{"class":170},[149,3654,2096],{"class":177},[149,3656,181],{"class":170},[149,3658,195],{"class":170},[149,3660,2112],{"class":198},[149,3662,202],{"class":170},[149,3664,412],{"class":170},[149,3666,585],{"class":177},[149,3668,181],{"class":170},[149,3670,195],{"class":170},[149,3672,2489],{"class":198},[149,3674,202],{"class":170},[149,3676,412],{"class":170},[149,3678,2145],{"class":177},[149,3680,181],{"class":170},[149,3682,2453],{"class":166},[149,3684,592],{"class":170},[149,3686,220],{"class":177},[149,3688,3689,3691,3693,3695,3697,3699,3701,3703,3705,3707,3709,3711,3713,3715,3717,3719,3721,3723,3725,3727,3729,3731,3733],{"class":151,"line":672},[149,3690,2909],{"class":155},[149,3692,371],{"class":177},[149,3694,2914],{"class":170},[149,3696,2917],{"class":166},[149,3698,513],{"class":170},[149,3700,2922],{"class":166},[149,3702,919],{"class":177},[149,3704,922],{"class":155},[149,3706,2824],{"class":162},[149,3708,2931],{"class":170},[149,3710,167],{"class":177},[149,3712,2936],{"class":170},[149,3714,2939],{"class":177},[149,3716,181],{"class":170},[149,3718,2944],{"class":1477},[149,3720,412],{"class":170},[149,3722,2949],{"class":177},[149,3724,181],{"class":170},[149,3726,2856],{"class":166},[149,3728,513],{"class":170},[149,3730,375],{"class":166},[149,3732,592],{"class":170},[149,3734,220],{"class":177},[149,3736,3737,3739,3741,3743,3745,3747,3749,3751,3753,3755,3757,3759],{"class":151,"line":1311},[149,3738,2966],{"class":155},[149,3740,2278],{"class":162},[149,3742,2478],{"class":177},[149,3744,513],{"class":170},[149,3746,2112],{"class":162},[149,3748,167],{"class":177},[149,3750,202],{"class":170},[149,3752,2489],{"class":198},[149,3754,202],{"class":170},[149,3756,412],{"class":170},[149,3758,2453],{"class":166},[149,3760,220],{"class":177},[149,3762,3763,3765,3767,3769,3771,3773,3775,3777,3779],{"class":151,"line":1317},[149,3764,2993],{"class":162},[149,3766,2931],{"class":170},[149,3768,167],{"class":177},[149,3770,2936],{"class":170},[149,3772,2939],{"class":177},[149,3774,181],{"class":170},[149,3776,2512],{"class":1477},[149,3778,592],{"class":170},[149,3780,220],{"class":177},[149,3782,3783,3785],{"class":151,"line":1326},[149,3784,3014],{"class":170},[149,3786,220],{"class":177},[149,3788,3789,3791],{"class":151,"line":1639},[149,3790,636],{"class":170},[149,3792,220],{"class":177},[149,3794,3795,3797],{"class":151,"line":1654},[149,3796,667],{"class":170},[149,3798,220],{"class":177},[149,3800,3801,3803],{"class":151,"line":1661},[149,3802,217],{"class":170},[149,3804,220],{"class":166},[125,3806,3807,3808,244,3810,3812,3813,3815,3816,513],{},"The app that installs the package still owns the policy. With ",[146,3809,226],{},[146,3811,2657],{}," is denied until the app registers a ",[146,3814,250],{}," hook that allows ",[146,3817,2489],{},[275,3819,3821],{"id":3820},"multi-instance-notes","Multi-instance notes",[228,3823,3824,3831,3838,3849,3860],{},[231,3825,3826,3827,3830],{},"Presence, locks and rooms live in storage, so all instances must share it. Set the ",[146,3828,3829],{},"redis"," option.",[231,3832,3833,3834,3837],{},"Presence and lock changes are relayed over the module's pub\u002Fsub (the ",[146,3835,3836],{},"nuxt-realtime:broadcast"," channel), so a client on instance B sees a change made through instance A. This still uses two Redis connections per instance.",[231,3839,3840,3841,3844,3845,3848],{},"Engine.IO polling keeps its session in memory on one instance. Use sticky sessions at your load balancer, or set ",[146,3842,3843],{},"socketio.serverOptions.transports"," to ",[146,3846,3847],{},"['websocket']",". This comes from Engine.IO and has not been tested with this module.",[231,3850,3851,3852,3855,3856,3859],{},"Each instance writes a liveness timestamp on every sweep tick. If an instance is silent for longer than ",[146,3853,3854],{},"instanceTimeoutMs"," (default 30 seconds), its connections are marked stale. After ",[146,3857,3858],{},"lock.staleGraceMs"," their locks, presence and room membership are released and broadcast, so a crashed instance does not leave them behind.",[231,3861,3862],{},"The transport depends on crossws's Node adapter internals, so it only runs on Node.",[125,3864,3865,3866,3868],{},"See ",[129,3867,98],{"href":99}," for how state and events travel.",[275,3870,3872],{"id":3871},"running-the-realtime-server-on-its-own","Running the realtime server on its own",[125,3874,1049,3875,3878],{},[146,3876,3877],{},"socketio.serverUrl"," option already points the client at a separate server. The design for a standalone deployment (for example the realtime server on Railway and the Nuxt app on Vercel) uses the pieces above, with no JWT library built in:",[3880,3881,3882,3885,3895,3903],"ol",{},[231,3883,3884],{},"The Nuxt app issues a short-lived token (for example a JWT) for the logged-in user.",[231,3886,3887,3888,3890,3891,3894],{},"The client sends it in ",[146,3889,703],{}," as ",[146,3892,3893],{},"ctx.query.token",", so it arrives with the handshake.",[231,3896,3897,3898,3900,3901,513],{},"The realtime server verifies it in ",[146,3899,236],{}," with a library you pick, and copies the claims to ",[146,3902,287],{},[231,3904,3905,3906,3909],{},"Set ",[146,3907,3908],{},"socketio.serverOptions.cors.origin"," to the origin of the Nuxt app.",[125,3911,3912],{},"Cookies from the app's origin do not reach another origin, so use the token rather than a session cookie. Because the query is one attempt behind on reconnect, keep the token lifetime longer than a reconnect cycle, or accept one failed retry.",[275,3914,3916],{"id":3915},"not-built-in","Not built in",[125,3918,3919],{},"These features are not shipped. Each has a seam you can build on today.",[447,3921,3923],{"id":3922},"schema-validation","Schema validation",[125,3925,3926,3927,3930,3931,425,3933,3930,3936,3938,3939,3942,3943,3945],{},"Validate ",[146,3928,3929],{},"ctx.value"," in ",[146,3932,253],{},[146,3934,3935],{},"ctx.data",[146,3937,250],{},", and call ",[146,3940,3941],{},"ctx.deny('Invalid')",". For custom events, validate before ",[146,3944,2051],{}," or inside the handler.",[447,3947,3949],{"id":3948},"extra-rate-limits","Extra rate limits",[125,3951,3952,3953,3955],{},"The built-in limit is per connection and per second. Add per-user or per-key limits in a gate hook, or call your own counter before ",[146,3954,2051],{}," in a custom event.",[447,3957,3959],{"id":3958},"lock-ownership-rules","Lock ownership rules",[125,3961,3962,3963,371,3965,3968,3969,3972,3973,425,3975,513],{},"Restrict who may claim a lock with ",[146,3964,247],{},[146,3966,3967],{},"kind: 'lock'","), and who may take it over with ",[146,3970,3971],{},"canForceRelease",", which has ",[146,3974,648],{},[146,3976,3977],{},"currentOwner",[447,3979,3981],{"id":3980},"history-and-replay","History and replay",[125,3983,3984,3985,3987,3988,3991,3992,513],{},"Record events in ",[146,3986,2667],{}," and state changes in ",[146,3989,3990],{},"afterWrite",", store them yourself, and replay with ",[146,3993,3994],{},"useRealtimeServer().publish",[447,3996,3998],{"id":3997},"atomic-increment-or-compare-and-set","Atomic increment or compare-and-set",[125,4000,4001,4003,4004,4007,4008,4010],{},[146,4002,1199],{}," is last write wins. Add a custom event, gate it with ",[146,4005,4006],{},"guard({ kind: 'write' })",", and do the read-modify-write in your own code with ",[146,4009,2263],{},". It is only atomic on one instance unless your storage supports it.",[447,4012,4014],{"id":4013},"yjs-provider","Yjs provider",[125,4016,4017,4018,4020,4021,4023],{},"Add custom events for the Yjs sync messages, gate them with ",[146,4019,2051],{},", and persist updates from ",[146,4022,2667],{}," or your own handler.",[447,4025,4027],{"id":4026},"hosted-multi-tenant","Hosted multi-tenant",[125,4029,4030,4031,4033,4034,4036],{},"Isolating tenants means prefixing keys and channels per tenant. Do it in ",[146,4032,986],{}," (put the tenant in ",[146,4035,287],{},") and enforce the prefix in each gate hook.",[447,4038,4040],{"id":4039},"durable-objects-or-other-runtimes","Durable Objects or other runtimes",[125,4042,4043,4044,4047,4048,513],{},"The Node-only part is ",[146,4045,4046],{},"src\u002Fruntime\u002Fserver\u002Futils\u002Ftransport.ts",". A new adapter would replace it, and cross-instance messaging would need another ",[146,4049,4050],{},"PubSubDriver",[275,4052,4054],{"id":4053},"known-limits","Known limits",[228,4056,4057,4067,4076,4083,4094,4097,4100],{},[231,4058,4059,4060,4062,4063,4066],{},"A denied ",[146,4061,243],{}," mid-session only removes the socket from the ",[146,4064,4065],{},"room:"," channel. Presence and lock-room channels it joined earlier stay until it reconnects.",[231,4068,4069,4070,4072,4073,4075],{},"A client that reconnects to another instance within about ",[146,4071,3854],{}," of a crash cannot reclaim its ",[146,4074,1032],{}," and gets a fresh one. Its old locks are released by a later sweep.",[231,4077,4078,2032,4080,4082],{},[146,4079,2031],{},[146,4081,2035],{},", state values and event data are client data and reach other clients as sent. Gate them with hooks.",[231,4084,4085,425,4087,4089,4090,4093],{},[146,4086,1167],{},[146,4088,1147],{}," accept an optional acknowledgement with ",[146,4091,4092],{},"{ success, error? }",", but the built-in composables do not use it yet. A denied subscribe is silent in the UI.",[231,4095,4096],{},"Polling with sticky sessions, and the multi-instance flows behind a real load balancer, have not been tested.",[231,4098,4099],{},"The transport is Node only.",[231,4101,4102,4103,4105,4106,4108],{},"The module does not verify tokens or sessions. ",[146,4104,1006],{}," is whatever your ",[146,4107,986],{}," hook sets.",[275,4110,4112],{"id":4111},"behavior-changes","Behavior changes",[125,4114,4115,4116,4118],{},"These apply even with ",[146,4117,420],{}," unset:",[3880,4120,4121,4130,4143,4148,4151,4160,4169],{},[231,4122,4123,4124,4126,4127,4129],{},"A cross-origin WebSocket gets a ",[146,4125,434],{}," before the upgrade. Before, it got ",[146,4128,402],{}," and was closed with code 1008.",[231,4131,4132,4133,4135,4136,2009,4139,4142],{},"Gate hooks vote. ",[146,4134,1702],{}," can no longer undo another hook's deny, and ",[146,4137,4138],{},"ctx.allow",[146,4140,4141],{},"undefined"," inside a hook.",[231,4144,4145,4147],{},[146,4146,243],{}," runs on every explicit join.",[231,4149,4150],{},"With Redis, presence and lock changes reach clients on other instances.",[231,4152,4153,4156,4157,513],{},[146,4154,4155],{},"useRealtimePresence().join()"," resolves a ",[146,4158,4159],{},"boolean",[231,4161,4162,4163,4165,4166,4168],{},"A registered ",[146,4164,986],{}," hook that rejects refuses the connection, even with ",[146,4167,420],{}," unset.",[231,4170,4171,4172,4174],{},"No socket handler runs before ",[146,4173,1070],{}," has finished. Messages dropped by the rate limit or a rejected socket now answer an acknowledgement with a failure instead of leaving the call hanging.",[4176,4177,4178],"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 .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}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 .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":144,"searchDepth":152,"depth":174,"links":4180},[4181,4185,4186,4190,4191,4196,4197,4198,4199,4209,4210],{"id":277,"depth":174,"text":278,"children":4182},[4183,4184],{"id":449,"depth":187,"text":450},{"id":696,"depth":187,"text":697},{"id":999,"depth":174,"text":1000},{"id":1081,"depth":174,"text":1082,"children":4187},[4188,4189],{"id":1682,"depth":187,"text":1683},{"id":1721,"depth":187,"text":1722},{"id":1736,"depth":174,"text":1737},{"id":2043,"depth":174,"text":2044,"children":4192},[4193,4194,4195],{"id":2050,"depth":187,"text":2051},{"id":2262,"depth":187,"text":2263},{"id":2523,"depth":187,"text":2524},{"id":2635,"depth":174,"text":2636},{"id":3820,"depth":174,"text":3821},{"id":3871,"depth":174,"text":3872},{"id":3915,"depth":174,"text":3916,"children":4200},[4201,4202,4203,4204,4205,4206,4207,4208],{"id":3922,"depth":187,"text":3923},{"id":3948,"depth":187,"text":3949},{"id":3958,"depth":187,"text":3959},{"id":3980,"depth":187,"text":3981},{"id":3997,"depth":187,"text":3998},{"id":4013,"depth":187,"text":4014},{"id":4026,"depth":187,"text":4027},{"id":4039,"depth":187,"text":4040},{"id":4053,"depth":174,"text":4054},{"id":4111,"depth":174,"text":4112},"Require authentication, gate reads and writes with hooks, and extend the realtime server.","md",null,{},{"icon":36},{"title":33,"description":4211},"HclXB5so7MziLj9Q0WbSmwFvC9TSpFfGTqaa6tIOh_g",[4219,4221],{"title":28,"path":29,"stem":30,"description":4220,"icon":31,"children":-1},"Authenticate Socket.IO clients with the nuxt-realtime:authenticate hook, or add your own io.use() middleware.",{"title":38,"path":39,"stem":40,"description":4222,"icon":41,"children":-1},"The \"Realtime\" Nuxt DevTools tab for inspecting connections, storage, and events.",1796040902337]