[{"data":1,"prerenderedAt":456},["ShallowReactive",2],{"navigation":3,"-guide-message":83,"-guide-message-surround":452},[4,46],{"title":5,"path":6,"stem":7,"children":8,"icon":10},"Guide","\u002Fguide","1.guide\u002F1.index",[9,11,16,21,26,31,36,41],{"title":5,"path":6,"stem":7,"icon":10},"ph:book-open-duotone",{"title":12,"path":13,"stem":14,"icon":15},"Hooks","\u002Fguide\u002Fhooks","1.guide\u002F2.hooks","material-symbols-light:data-object",{"title":17,"path":18,"stem":19,"icon":20},"Peer","\u002Fguide\u002Fpeer","1.guide\u002F3.peer","mynaui:api",{"title":22,"path":23,"stem":24,"icon":25},"Message","\u002Fguide\u002Fmessage","1.guide\u002F4.message","solar:letter-line-duotone",{"title":27,"path":28,"stem":29,"icon":30},"Pub \u002F Sub","\u002Fguide\u002Fpubsub","1.guide\u002F5.pubsub","simple-icons:googlepubsub",{"title":32,"path":33,"stem":34,"icon":35},"Sync Backplane","\u002Fguide\u002Fsync","1.guide\u002F6.sync","tabler:refresh",{"title":37,"path":38,"stem":39,"icon":40},"Resolver API","\u002Fguide\u002Fresolver","1.guide\u002F7.resolver","tabler:route",{"title":42,"path":43,"stem":44,"icon":45},"WebSocket Proxy","\u002Fguide\u002Fproxy","1.guide\u002F8.proxy","tabler:arrows-exchange",{"title":47,"path":48,"stem":49,"children":50,"icon":52},"Adapters","\u002Fadapters","2.adapters\u002F1.index",[51,53,58,63,68,73,78],{"title":47,"path":48,"stem":49,"icon":52},"emojione-monotone:electric-plug",{"title":54,"path":55,"stem":56,"icon":57},"Bun","\u002Fadapters\u002Fbun","2.adapters\u002Fbun","simple-icons:bun",{"title":59,"path":60,"stem":61,"icon":62},"Bunny","\u002Fadapters\u002Fbunny","2.adapters\u002Fbunny","mdi:rabbit",{"title":64,"path":65,"stem":66,"icon":67},"Cloudflare","\u002Fadapters\u002Fcloudflare","2.adapters\u002Fcloudflare","devicon-plain:cloudflareworkers",{"title":69,"path":70,"stem":71,"icon":72},"Deno","\u002Fadapters\u002Fdeno","2.adapters\u002Fdeno","teenyicons:deno-solid",{"title":74,"path":75,"stem":76,"icon":77},"Node.js","\u002Fadapters\u002Fnode","2.adapters\u002Fnode","akar-icons:node-fill",{"title":79,"path":80,"stem":81,"icon":82},"SSE","\u002Fadapters\u002Fsse","2.adapters\u002Fsse","clarity:two-way-arrows-line",{"id":84,"title":22,"body":85,"description":246,"extension":447,"meta":448,"navigation":449,"path":23,"seo":450,"stem":24,"__hash__":451},"content\u002F1.guide\u002F4.message.md",{"type":86,"value":87,"toc":428,"icon":25},"minimark",[88,102,117,122,129,138,144,152,158,165,171,174,180,190,194,200,203,206,212,223,285,291,302,305,311,328,330,336,345,347,351,424],[89,90,91,92,96,97,101],"p",{},"On ",[93,94,95],"code",{},"message"," ",[98,99,100],"a",{"href":13},"hook",", you receive a message object containing data from the client.",[103,104,105],"note",{},[89,106,107,108,116],{},"\nMessage object is API-compatible with standard Websocket ",[98,109,113],{"href":110,"rel":111},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FWebSocket\u002Fmessage_event",[112],"nofollow",[93,114,115],{},"MessageEvent"," with convenient superset of utils.",[118,119,121],"h2",{"id":120},"instance-properties","Instance properties",[123,124,126],"h3",{"id":125},"messageid",[93,127,128],{},"message.id",[89,130,131,132,137],{},"Unique random identifier (",[98,133,136],{"href":134,"rel":135},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FGlossary\u002FUUID",[112],"uuid v4",") for the message.",[123,139,141],{"id":140},"messageevent",[93,142,143],{},"message.event",[89,145,146,147,151],{},"Access to the original ",[98,148,150],{"href":110,"rel":149},[112],"message event"," if available.",[123,153,155],{"id":154},"messagepeer",[93,156,157],{},"message.peer",[89,159,160,161,164],{},"Access to the ",[98,162,163],{"href":18},"peer instance"," that emitted the message.",[123,166,168],{"id":167},"messagerawdata",[93,169,170],{},"message.rawData",[89,172,173],{},"Raw message data (can be of any type).",[123,175,177],{"id":176},"messagedata",[93,178,179],{},"message.data",[89,181,182,183,189],{},"Message data (value varies based on ",[98,184,186],{"href":185},"\u002Fguide\u002Fpeer#peerbinarytype",[93,187,188],{},"peer.binaryType",").",[118,191,193],{"id":192},"instance-methods","Instance methods",[123,195,197],{"id":196},"messagetext",[93,198,199],{},"message.text()",[89,201,202],{},"Get stringified text version of the message.",[89,204,205],{},"If raw data is in any other format, it will be automatically converted or decoded.",[123,207,209],{"id":208},"messagejson",[93,210,211],{},"message.json()",[89,213,214,215,222],{},"Get parsed version of the message text with ",[98,216,219],{"href":217,"rel":218},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FJSON\u002Fparse",[112],[93,220,221],{},"JSON.parse()",".",[224,225,226,237,240],"tip",{},[89,227,228,229,236],{},"\nYou can optionally use ",[98,230,233],{"href":231,"rel":232},"https:\u002F\u002Fgithub.com\u002Funjs\u002Fdestr",[112],[93,234,235],{},"unjs\u002Fdestr"," to safely parse the message object.",[89,238,239],{},"It does not throw an error if the input is not valid JSON but falls back to text and also removes any fields that could potentially cause prototype pollution vulnerabilities.",[241,242,247],"pre",{"className":243,"code":244,"language":245,"meta":246,"style":246},"language-ts shiki shiki-themes github-light github-dark github-dark","const data = destr(await message.text());\n","ts","",[93,248,249],{"__ignoreMap":246},[250,251,254,258,262,265,269,273,276,279,282],"span",{"class":252,"line":253},"line",1,[250,255,257],{"class":256},"so5gQ","const",[250,259,261],{"class":260},"suiK_"," data",[250,263,264],{"class":256}," =",[250,266,268],{"class":267},"shcOC"," destr",[250,270,272],{"class":271},"slsVL","(",[250,274,275],{"class":256},"await",[250,277,278],{"class":271}," message.",[250,280,281],{"class":267},"text",[250,283,284],{"class":271},"());\n",[123,286,288],{"id":287},"messageuint8array",[93,289,290],{},"message.uint8Array()",[89,292,293,294,301],{},"Get data as ",[98,295,298],{"href":296,"rel":297},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FUint8Array",[112],[93,299,300],{},"Uint8Array"," value.",[89,303,304],{},"If raw data is in any other format or string, it will be automatically converted or encoded.",[123,306,308],{"id":307},"messagearraybuffer",[93,309,310],{},"message.arrayBuffer()",[89,312,293,313,320,321,301],{},[98,314,317],{"href":315,"rel":316},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FArrayBuffer",[112],[93,318,319],{},"ArrayBuffer"," or ",[98,322,325],{"href":323,"rel":324},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FJavaScript\u002FReference\u002FGlobal_Objects\u002FSharedArrayBuffer",[112],[93,326,327],{},"SharedArrayBuffer",[89,329,304],{},[123,331,333],{"id":332},"messageblob",[93,334,335],{},"message.blob()",[89,337,293,338,301],{},[98,339,342],{"href":340,"rel":341},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FBlob",[112],[93,343,344],{},"Blob",[89,346,304],{},[118,348,350],{"id":349},"adapter-support","Adapter support",[352,353,354,397],"table",{},[355,356,357],"thead",{},[358,359,360,363,367,371,377,381,386,392],"tr",{},[361,362],"th",{},[361,364,365],{},[98,366,54],{"href":55},[361,368,369],{},[98,370,64],{"href":65},[361,372,373],{},[98,374,376],{"href":375},"\u002Fadapters\u002Fcloudflare#durable-objects","Cloudflare (durable)",[361,378,379],{},[98,380,69],{"href":70},[361,382,383],{},[98,384,385],{"href":75},"Node (ws)",[361,387,388],{},[98,389,391],{"href":390},"\u002Fadapters\u002Fnode#uwebsockets","Node (μWebSockets)",[361,393,394],{},[98,395,79],{"href":396},"adapters\u002Fsse",[398,399,400],"tbody",{},[358,401,402,408,411,414,416,418,420,422],{},[403,404,405],"td",{},[93,406,407],{},"event",[403,409,410],{},"⨉",[403,412,413],{},"✓",[403,415,410],{},[403,417,413],{},[403,419,410],{},[403,421,410],{},[403,423,410],{},[425,426,427],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}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);}",{"title":246,"searchDepth":429,"depth":429,"links":430},2,[431,439,446],{"id":120,"depth":429,"text":121,"children":432},[433,435,436,437,438],{"id":125,"depth":434,"text":128},3,{"id":140,"depth":434,"text":143},{"id":154,"depth":434,"text":157},{"id":167,"depth":434,"text":170},{"id":176,"depth":434,"text":179},{"id":192,"depth":429,"text":193,"children":440},[441,442,443,444,445],{"id":196,"depth":434,"text":199},{"id":208,"depth":434,"text":211},{"id":287,"depth":434,"text":290},{"id":307,"depth":434,"text":310},{"id":332,"depth":434,"text":335},{"id":349,"depth":429,"text":350},"md",{"icon":25},{"icon":25},{"title":22,"description":246},"bxz8AFIy4zOlDP9e3YV3cJZp9np_9IaMdGqitRmUgbA",[453,455],{"title":17,"path":18,"stem":19,"description":454,"icon":20,"children":-1},"Peer object allows easily interacting with connected clients.",{"title":27,"path":28,"stem":29,"description":246,"icon":30,"children":-1},1782852618201]