[{"data":1,"prerenderedAt":1541},["ShallowReactive",2],{"navigation":3,"-guide-peer":83,"-guide-peer-surround":1537},[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":17,"body":85,"description":1531,"extension":1532,"meta":1533,"navigation":1534,"path":18,"seo":1535,"stem":19,"__hash__":1536},"content\u002F1.guide\u002F3.peer.md",{"type":86,"value":87,"toc":1508,"icon":20},"minimark",[88,92,97,105,116,122,125,142,148,151,158,164,175,185,191,194,201,271,276,282,285,291,294,300,303,318,329,333,339,342,348,368,472,495,513,519,522,525,531,534,536,542,545,547,553,556,559,603,609,614,617,623,627,1180,1504],[89,90,91],"p",{},"When a new client connects to the server, crossws creates a peer instance that allows getting information from clients and sending messages to them.",[93,94,96],"h2",{"id":95},"instance-properties","Instance properties",[98,99,101],"h3",{"id":100},"peerid",[102,103,104],"code",{},"peer.id",[89,106,107,108,115],{},"Unique random identifier (",[109,110,114],"a",{"href":111,"rel":112},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FGlossary\u002FUUID",[113],"nofollow","uuid v4",") for the peer.",[98,117,119],{"id":118},"peerrequest",[102,120,121],{},"peer.request?",[89,123,124],{},"Access to the upgrade request info. You can use it to do authentication and access users headers and cookies.",[126,127,128],"note",{},[89,129,130,131,136,137,141],{},"\nThis property is compatible with web ",[109,132,135],{"href":133,"rel":134},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FRequest",[113],"Request"," interface, However interface is emulated for Node.js and sometimes unavailable. Refer to the ",[109,138,140],{"href":139},"#compatibility","compatibility table"," for more info.",[98,143,145],{"id":144},"peerremoteaddress",[102,146,147],{},"peer.remoteAddress?",[89,149,150],{},"The IP address of the client.",[126,152,153],{},[89,154,155,156,141],{},"\nNot all adapters provide this. Refer to the ",[109,157,140],{"href":139},[98,159,161],{"id":160},"peerwebsocket",[102,162,163],{},"peer.websocket",[89,165,166,167,174],{},"Direct access to the ",[109,168,171],{"href":169,"rel":170},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FWebSocket",[113],[102,172,173],{},"WebSocket"," instance.",[126,176,177],{},[89,178,179,180,182,183,141],{},"\nWebSocket properties vary across runtimes. When accessing ",[102,181,163],{},", a lightweight proxy increases stability. Refer to the ",[109,184,140],{"href":139},[98,186,188],{"id":187},"peercontext",[102,189,190],{},"peer.context",[89,192,193],{},"The context is an object that contains arbitrary information about the request.",[89,195,196,197,200],{},"You can augment the ",[102,198,199],{},"PeerContext"," interface types to add your properties.",[202,203,208],"pre",{"className":204,"code":205,"language":206,"meta":207,"style":207},"language-ts shiki shiki-themes github-light github-dark github-dark","declare module \"crossws\" {\n  interface PeerContext {\n    customData?: string[];\n  }\n}\n","ts","",[102,209,210,230,242,259,265],{"__ignoreMap":207},[211,212,215,219,222,226],"span",{"class":213,"line":214},"line",1,[211,216,218],{"class":217},"so5gQ","declare",[211,220,221],{"class":217}," module",[211,223,225],{"class":224},"sfrk1"," \"crossws\"",[211,227,229],{"class":228},"slsVL"," {\n",[211,231,233,236,240],{"class":213,"line":232},2,[211,234,235],{"class":217},"  interface",[211,237,239],{"class":238},"shcOC"," PeerContext",[211,241,229],{"class":228},[211,243,245,249,252,256],{"class":213,"line":244},3,[211,246,248],{"class":247},"sQHwn","    customData",[211,250,251],{"class":217},"?:",[211,253,255],{"class":254},"suiK_"," string",[211,257,258],{"class":228},"[];\n",[211,260,262],{"class":213,"line":261},4,[211,263,264],{"class":228},"  }\n",[211,266,268],{"class":213,"line":267},5,[211,269,270],{"class":228},"}\n",[126,272,273],{},[89,274,275],{},"\ncontext data can be volatile in some runtimes.",[98,277,279],{"id":278},"peertopics",[102,280,281],{},"peer.topics",[89,283,284],{},"All topics, this peer has been subscribed to.",[98,286,288],{"id":287},"peernamespace",[102,289,290],{},"peer.namespace",[89,292,293],{},"Peer's pubsub namespace.",[98,295,297],{"id":296},"peerbufferedamount",[102,298,299],{},"peer.bufferedAmount",[89,301,302],{},"Number of bytes queued for transmission but not yet flushed to the client.",[89,304,305,306,310,311,317],{},"Use this to apply ",[307,308,309],"strong",{},"backpressure",": pause sending while it grows past a high watermark and resume once it drops. This prevents a fast producer (for example a streaming async generator) from filling the adapter's send buffer faster than the client can drain it. The easiest way to wait is ",[109,312,314],{"href":313},"#peerwaitfordrain",[102,315,316],{},"peer.waitForDrain()",".",[126,319,320],{},[89,321,322,323,326,327,141],{},"\nNot all adapters expose a buffer signal; those return ",[102,324,325],{},"0",". Refer to the ",[109,328,140],{"href":139},[93,330,332],{"id":331},"instance-methods","Instance methods",[98,334,336],{"id":335},"peersendmessage-compress",[102,337,338],{},"peer.send(message, { compress? })",[89,340,341],{},"Send a message to the connected client.",[98,343,345],{"id":344},"peerwaitfordrain-threshold-pollinterval-signal",[102,346,347],{},"peer.waitForDrain({ threshold?, pollInterval?, signal? })",[89,349,350,351,356,357,360,361,363,364,367],{},"Returns a promise that resolves once ",[109,352,354],{"href":353},"#peerbufferedamount",[102,355,299],{}," drops to or below ",[102,358,359],{},"threshold"," bytes (default ",[102,362,325],{},"), letting you ",[102,365,366],{},"await"," backpressure relief in a send loop:",[202,369,371],{"className":204,"code":370,"language":206,"meta":207,"style":207},"\u002F\u002F Throttle a fast producer to the client's pace\nfor (const chunk of stream) {\n  peer.send(chunk);\n  if (peer.bufferedAmount > 1024 * 1024 \u002F* 1MB *\u002F) {\n    await peer.waitForDrain({ threshold: 256 * 1024 \u002F* 256KB *\u002F });\n  }\n}\n",[102,372,373,379,399,410,435,462,467],{"__ignoreMap":207},[211,374,375],{"class":213,"line":214},[211,376,378],{"class":377},"sCsY4","\u002F\u002F Throttle a fast producer to the client's pace\n",[211,380,381,384,387,390,393,396],{"class":213,"line":232},[211,382,383],{"class":217},"for",[211,385,386],{"class":228}," (",[211,388,389],{"class":217},"const",[211,391,392],{"class":254}," chunk",[211,394,395],{"class":217}," of",[211,397,398],{"class":228}," stream) {\n",[211,400,401,404,407],{"class":213,"line":244},[211,402,403],{"class":228},"  peer.",[211,405,406],{"class":238},"send",[211,408,409],{"class":228},"(chunk);\n",[211,411,412,415,418,421,424,427,429,432],{"class":213,"line":261},[211,413,414],{"class":217},"  if",[211,416,417],{"class":228}," (peer.bufferedAmount ",[211,419,420],{"class":217},">",[211,422,423],{"class":254}," 1024",[211,425,426],{"class":217}," *",[211,428,423],{"class":254},[211,430,431],{"class":377}," \u002F* 1MB *\u002F",[211,433,434],{"class":228},") {\n",[211,436,437,440,443,446,449,452,454,456,459],{"class":213,"line":267},[211,438,439],{"class":217},"    await",[211,441,442],{"class":228}," peer.",[211,444,445],{"class":238},"waitForDrain",[211,447,448],{"class":228},"({ threshold: ",[211,450,451],{"class":254},"256",[211,453,426],{"class":217},[211,455,423],{"class":254},[211,457,458],{"class":377}," \u002F* 256KB *\u002F",[211,460,461],{"class":228}," });\n",[211,463,465],{"class":213,"line":464},6,[211,466,264],{"class":228},[211,468,470],{"class":213,"line":469},7,[211,471,270],{"class":228},[89,473,474,475,478,479,482,483,486,487,490,491,494],{},"It resolves immediately when there is no backpressure (or on adapters that do not report ",[102,476,477],{},"bufferedAmount","). Otherwise it polls every ",[102,480,481],{},"pollInterval"," ms (default ",[102,484,485],{},"100",") until the buffer drains, and also resolves early if the connection is no longer open so a send loop never hangs on a dropped client. Pass a ",[102,488,489],{},"signal"," (e.g. ",[102,492,493],{},"AbortSignal.timeout(ms)",") to abort the wait — the promise then rejects with the signal's reason.",[496,497,498],"tip",{},[89,499,500,501,503,504,510,511,317],{},"\nFor event-driven backpressure (instead of ",[102,502,366],{},"ing in a loop), use the ",[109,505,506,509],{"href":13},[102,507,508],{},"drain"," hook"," together with ",[102,512,299],{},[98,514,516],{"id":515},"peersubscribechannel",[102,517,518],{},"peer.subscribe(channel)",[89,520,521],{},"Join a broadcast channel.",[523,524],"read-more",{"to":28},[98,526,528],{"id":527},"peerunsubscribechannel",[102,529,530],{},"peer.unsubscribe(channel)",[89,532,533],{},"Leave a broadcast channel.",[523,535],{"to":28},[98,537,539],{"id":538},"peerpublishchannel-message",[102,540,541],{},"peer.publish(channel, message)",[89,543,544],{},"Broadcast a message to the channel. The peer that the publish is called on itself is excluded from the broadcast.",[523,546],{"to":28},[98,548,550],{"id":549},"peerclosecode-number",[102,551,552],{},"peer.close(code?, number?)",[89,554,555],{},"Gracefully closes the connection.",[89,557,558],{},"Here is a list of close codes:",[560,561,562,569,575,581,587,593],"ul",{},[563,564,565,568],"li",{},[102,566,567],{},"1000"," means \"normal closure\" (default)",[563,570,571,574],{},[102,572,573],{},"1009"," means a message was too big and was rejected",[563,576,577,580],{},[102,578,579],{},"1011"," means the server encountered an error",[563,582,583,586],{},[102,584,585],{},"1012"," means the server is restarting",[563,588,589,592],{},[102,590,591],{},"1013"," means the server is too busy or the client is rate-limited",[563,594,595,598,599,602],{},[102,596,597],{},"4000"," through ",[102,600,601],{},"4999"," are reserved for applications (you can use it!)",[89,604,605,606,317],{},"To close the connection abruptly, use ",[102,607,608],{},"peer.terminate()",[98,610,612],{"id":611},"peerterminate",[102,613,608],{},[89,615,616],{},"Abruptly close the connection.",[89,618,619,620,317],{},"To gracefully close the connection, use ",[102,621,622],{},"peer.close()",[93,624,626],{"id":625},"compatibility","Compatibility",[628,629,630,673],"table",{},[631,632,633],"thead",{},[634,635,636,639,643,647,653,657,662,668],"tr",{},[637,638],"th",{},[637,640,641],{},[109,642,54],{"href":55},[637,644,645],{},[109,646,64],{"href":65},[637,648,649],{},[109,650,652],{"href":651},"\u002Fadapters\u002Fcloudflare#durable-objects","Cloudflare (durable)",[637,654,655],{},[109,656,69],{"href":70},[637,658,659],{},[109,660,661],{"href":75},"Node (ws)",[637,663,664],{},[109,665,667],{"href":666},"\u002Fadapters\u002Fnode#uwebsockets","Node (μWebSockets)",[637,669,670],{},[109,671,79],{"href":672},"adapters\u002Fsse",[674,675,676,699,754,775,810,851,897,940,961,982,1029,1089,1124,1159],"tbody",{},[634,677,678,684,687,689,691,693,695,697],{},[679,680,681],"td",{},[102,682,683],{},"send()",[679,685,686],{},"✓",[679,688,686],{},[679,690,686],{},[679,692,686],{},[679,694,686],{},[679,696,686],{},[679,698,686],{},[634,700,701,710,712,715,728,736,744,746],{},[679,702,703,706,707],{},[102,704,705],{},"publish()"," \u002F ",[102,708,709],{},"subscribe()",[679,711,686],{},[679,713,714],{},"⨉",[679,716,717,718],{},"✓ ",[719,720,721],"sup",{},[109,722,727],{"href":723,"ariaDescribedBy":724,"dataFootnoteRef":207,"id":726},"#user-content-fn-1",[725],"footnote-label","user-content-fnref-1","1",[679,729,717,730],{},[719,731,732],{},[109,733,727],{"href":723,"ariaDescribedBy":734,"dataFootnoteRef":207,"id":735},[725],"user-content-fnref-1-2",[679,737,717,738],{},[719,739,740],{},[109,741,727],{"href":723,"ariaDescribedBy":742,"dataFootnoteRef":207,"id":743},[725],"user-content-fnref-1-3",[679,745,686],{},[679,747,717,748],{},[719,749,750],{},[109,751,727],{"href":723,"ariaDescribedBy":752,"dataFootnoteRef":207,"id":753},[725],"user-content-fnref-1-4",[634,755,756,761,763,765,767,769,771,773],{},[679,757,758],{},[102,759,760],{},"close()",[679,762,686],{},[679,764,686],{},[679,766,686],{},[679,768,686],{},[679,770,686],{},[679,772,686],{},[679,774,686],{},[634,776,777,782,784,794,796,798,800,802],{},[679,778,779],{},[102,780,781],{},"terminate()",[679,783,686],{},[679,785,717,786],{},[719,787,788],{},[109,789,793],{"href":790,"ariaDescribedBy":791,"dataFootnoteRef":207,"id":792},"#user-content-fn-2",[725],"user-content-fnref-2","2",[679,795,686],{},[679,797,686],{},[679,799,686],{},[679,801,686],{},[679,803,717,804],{},[719,805,806],{},[109,807,793],{"href":790,"ariaDescribedBy":808,"dataFootnoteRef":207,"id":809},[725],"user-content-fnref-2-2",[634,811,812,816,818,829,837,839,841,843],{},[679,813,814],{},[102,815,477],{},[679,817,686],{},[679,819,820,821],{},"⨉ ",[719,822,823],{},[109,824,828],{"href":825,"ariaDescribedBy":826,"dataFootnoteRef":207,"id":827},"#user-content-fn-8",[725],"user-content-fnref-8","3",[679,830,820,831],{},[719,832,833],{},[109,834,828],{"href":825,"ariaDescribedBy":835,"dataFootnoteRef":207,"id":836},[725],"user-content-fnref-8-2",[679,838,686],{},[679,840,686],{},[679,842,686],{},[679,844,820,845],{},[719,846,847],{},[109,848,828],{"href":825,"ariaDescribedBy":849,"dataFootnoteRef":207,"id":850},[725],"user-content-fnref-8-3",[634,852,853,857,859,869,877,885,887,889],{},[679,854,855,509],{},[102,856,508],{},[679,858,686],{},[679,860,820,861],{},[719,862,863],{},[109,864,868],{"href":865,"ariaDescribedBy":866,"dataFootnoteRef":207,"id":867},"#user-content-fn-9",[725],"user-content-fnref-9","4",[679,870,820,871],{},[719,872,873],{},[109,874,868],{"href":865,"ariaDescribedBy":875,"dataFootnoteRef":207,"id":876},[725],"user-content-fnref-9-2",[679,878,820,879],{},[719,880,881],{},[109,882,868],{"href":865,"ariaDescribedBy":883,"dataFootnoteRef":207,"id":884},[725],"user-content-fnref-9-3",[679,886,686],{},[679,888,686],{},[679,890,820,891],{},[719,892,893],{},[109,894,868],{"href":865,"ariaDescribedBy":895,"dataFootnoteRef":207,"id":896},[725],"user-content-fnref-9-4",[634,898,899,904,906,908,918,920,930,938],{},[679,900,901],{},[102,902,903],{},"request",[679,905,686],{},[679,907,686],{},[679,909,717,910],{},[719,911,912],{},[109,913,917],{"href":914,"ariaDescribedBy":915,"dataFootnoteRef":207,"id":916},"#user-content-fn-30",[725],"user-content-fnref-30","5",[679,919,686],{},[679,921,717,922],{},[719,923,924],{},[109,925,929],{"href":926,"ariaDescribedBy":927,"dataFootnoteRef":207,"id":928},"#user-content-fn-31",[725],"user-content-fnref-31","6",[679,931,717,932],{},[719,933,934],{},[109,935,929],{"href":926,"ariaDescribedBy":936,"dataFootnoteRef":207,"id":937},[725],"user-content-fnref-31-2",[679,939,686],{},[634,941,942,947,949,951,953,955,957,959],{},[679,943,944],{},[102,945,946],{},"remoteAddress",[679,948,686],{},[679,950,714],{},[679,952,714],{},[679,954,686],{},[679,956,686],{},[679,958,686],{},[679,960,714],{},[634,962,963,968,970,972,974,976,978,980],{},[679,964,965],{},[102,966,967],{},"websocket.url",[679,969,686],{},[679,971,686],{},[679,973,686],{},[679,975,686],{},[679,977,686],{},[679,979,686],{},[679,981,686],{},[634,983,984,989,999,1001,1003,1011,1019,1027],{},[679,985,986],{},[102,987,988],{},"websocket.extensions",[679,990,717,991],{},[719,992,993],{},[109,994,998],{"href":995,"ariaDescribedBy":996,"dataFootnoteRef":207,"id":997},"#user-content-fn-4",[725],"user-content-fnref-4","7",[679,1000,714],{},[679,1002,714],{},[679,1004,717,1005],{},[719,1006,1007],{},[109,1008,998],{"href":995,"ariaDescribedBy":1009,"dataFootnoteRef":207,"id":1010},[725],"user-content-fnref-4-2",[679,1012,717,1013],{},[719,1014,1015],{},[109,1016,998],{"href":995,"ariaDescribedBy":1017,"dataFootnoteRef":207,"id":1018},[725],"user-content-fnref-4-3",[679,1020,717,1021],{},[719,1022,1023],{},[109,1024,998],{"href":995,"ariaDescribedBy":1025,"dataFootnoteRef":207,"id":1026},[725],"user-content-fnref-4-4",[679,1028,714],{},[634,1030,1031,1036,1046,1054,1062,1071,1079,1087],{},[679,1032,1033],{},[102,1034,1035],{},"websocket.protocol",[679,1037,717,1038],{},[719,1039,1040],{},[109,1041,1045],{"href":1042,"ariaDescribedBy":1043,"dataFootnoteRef":207,"id":1044},"#user-content-fn-5",[725],"user-content-fnref-5","8",[679,1047,717,1048],{},[719,1049,1050],{},[109,1051,1045],{"href":1042,"ariaDescribedBy":1052,"dataFootnoteRef":207,"id":1053},[725],"user-content-fnref-5-2",[679,1055,717,1056],{},[719,1057,1058],{},[109,1059,1045],{"href":1042,"ariaDescribedBy":1060,"dataFootnoteRef":207,"id":1061},[725],"user-content-fnref-5-3",[679,1063,1064,1070],{},[719,1065,1066],{},[109,1067,1045],{"href":1042,"ariaDescribedBy":1068,"dataFootnoteRef":207,"id":1069},[725],"user-content-fnref-5-4"," ✓",[679,1072,717,1073],{},[719,1074,1075],{},[109,1076,1045],{"href":1042,"ariaDescribedBy":1077,"dataFootnoteRef":207,"id":1078},[725],"user-content-fnref-5-5",[679,1080,717,1081],{},[719,1082,1083],{},[109,1084,1045],{"href":1042,"ariaDescribedBy":1085,"dataFootnoteRef":207,"id":1086},[725],"user-content-fnref-5-6",[679,1088,714],{},[634,1090,1091,1096,1098,1100,1102,1104,1106,1116],{},[679,1092,1093],{},[102,1094,1095],{},"websocket.readyState",[679,1097,686],{},[679,1099,686],{},[679,1101,686],{},[679,1103,686],{},[679,1105,686],{},[679,1107,717,1108],{},[719,1109,1110],{},[109,1111,1115],{"href":1112,"ariaDescribedBy":1113,"dataFootnoteRef":207,"id":1114},"#user-content-fn-6",[725],"user-content-fnref-6","9",[679,1117,717,1118],{},[719,1119,1120],{},[109,1121,1115],{"href":1112,"ariaDescribedBy":1122,"dataFootnoteRef":207,"id":1123},[725],"user-content-fnref-6-2",[634,1125,1126,1131,1141,1143,1145,1147,1155,1157],{},[679,1127,1128],{},[102,1129,1130],{},"websocket.binaryType",[679,1132,717,1133],{},[719,1134,1135],{},[109,1136,1140],{"href":1137,"ariaDescribedBy":1138,"dataFootnoteRef":207,"id":1139},"#user-content-fn-7",[725],"user-content-fnref-7","10",[679,1142,714],{},[679,1144,714],{},[679,1146,686],{},[679,1148,717,1149],{},[719,1150,1151],{},[109,1152,1140],{"href":1137,"ariaDescribedBy":1153,"dataFootnoteRef":207,"id":1154},[725],"user-content-fnref-7-2",[679,1156,686],{},[679,1158,714],{},[634,1160,1161,1166,1168,1170,1172,1174,1176,1178],{},[679,1162,1163],{},[102,1164,1165],{},"websocket.bufferedAmount",[679,1167,714],{},[679,1169,714],{},[679,1171,714],{},[679,1173,686],{},[679,1175,686],{},[679,1177,686],{},[679,1179,714],{},[1181,1182,1185,1190],"section",{"className":1183,"dataFootnotes":207},[1184],"footnotes",[93,1186,1189],{"className":1187,"id":725},[1188],"sr-only","Footnotes",[1191,1192,1193,1226,1244,1273,1308,1324,1352,1396,1451,1473],"ol",{},[563,1194,1196,1197,1204,1205,1204,1212,1204,1219],{"id":1195},"user-content-fn-1","pubsub is not natively handled by runtime. peers are internally tracked. ",[109,1198,1203],{"href":1199,"ariaLabel":1200,"className":1201,"dataFootnoteBackref":207},"#user-content-fnref-1","Back to reference 1",[1202],"data-footnote-backref","↩"," ",[109,1206,1203,1210],{"href":1207,"ariaLabel":1208,"className":1209,"dataFootnoteBackref":207},"#user-content-fnref-1-2","Back to reference 1-2",[1202],[719,1211,793],{},[109,1213,1203,1217],{"href":1214,"ariaLabel":1215,"className":1216,"dataFootnoteBackref":207},"#user-content-fnref-1-3","Back to reference 1-3",[1202],[719,1218,828],{},[109,1220,1203,1224],{"href":1221,"ariaLabel":1222,"className":1223,"dataFootnoteBackref":207},"#user-content-fnref-1-4","Back to reference 1-4",[1202],[719,1225,868],{},[563,1227,1229,1231,1232,1204,1237],{"id":1228},"user-content-fn-2",[102,1230,760],{}," will be used for compatibility. ",[109,1233,1203],{"href":1234,"ariaLabel":1235,"className":1236,"dataFootnoteBackref":207},"#user-content-fnref-2","Back to reference 2",[1202],[109,1238,1203,1242],{"href":1239,"ariaLabel":1240,"className":1241,"dataFootnoteBackref":207},"#user-content-fnref-2-2","Back to reference 2-2",[1202],[719,1243,793],{},[563,1245,1247,1248,1250,1251,1253,1254,1204,1259,1204,1266],{"id":1246},"user-content-fn-8","The runtime exposes no send-buffer signal, so ",[102,1249,299],{}," reports ",[102,1252,325],{},". (Cloudflare buffers and applies backpressure internally; SSE has no equivalent.) ",[109,1255,1203],{"href":1256,"ariaLabel":1257,"className":1258,"dataFootnoteBackref":207},"#user-content-fnref-8","Back to reference 3",[1202],[109,1260,1203,1264],{"href":1261,"ariaLabel":1262,"className":1263,"dataFootnoteBackref":207},"#user-content-fnref-8-2","Back to reference 3-2",[1202],[719,1265,793],{},[109,1267,1203,1271],{"href":1268,"ariaLabel":1269,"className":1270,"dataFootnoteBackref":207},"#user-content-fnref-8-3","Back to reference 3-3",[1202],[719,1272,828],{},[563,1274,1276,1277,1281,1282,1204,1287,1204,1294,1204,1301],{"id":1275},"user-content-fn-9","The runtime emits no drain signal. Poll ",[109,1278,1279],{"href":353},[102,1280,299],{}," instead where it is available. ",[109,1283,1203],{"href":1284,"ariaLabel":1285,"className":1286,"dataFootnoteBackref":207},"#user-content-fnref-9","Back to reference 4",[1202],[109,1288,1203,1292],{"href":1289,"ariaLabel":1290,"className":1291,"dataFootnoteBackref":207},"#user-content-fnref-9-2","Back to reference 4-2",[1202],[719,1293,793],{},[109,1295,1203,1299],{"href":1296,"ariaLabel":1297,"className":1298,"dataFootnoteBackref":207},"#user-content-fnref-9-3","Back to reference 4-3",[1202],[719,1300,828],{},[109,1302,1203,1306],{"href":1303,"ariaLabel":1304,"className":1305,"dataFootnoteBackref":207},"#user-content-fnref-9-4","Back to reference 4-4",[1202],[719,1307,868],{},[563,1309,1311,1312,1315,1316,1318,1319],{"id":1310},"user-content-fn-30","After durable object's hibernation, only ",[102,1313,1314],{},"request.url"," (and ",[102,1317,104],{},") remain available due to 2048 byte in-memory state limit. ",[109,1320,1203],{"href":1321,"ariaLabel":1322,"className":1323,"dataFootnoteBackref":207},"#user-content-fnref-30","Back to reference 5",[1202],[563,1325,1327,1328,1331,1332,1335,1336,1339,1340,1204,1345],{"id":1326},"user-content-fn-31","using a proxy for ",[109,1329,135],{"href":133,"rel":1330},[113]," compatible interface (",[102,1333,1334],{},"url",", ",[102,1337,1338],{},"headers"," only) wrapping Node.js requests. ",[109,1341,1203],{"href":1342,"ariaLabel":1343,"className":1344,"dataFootnoteBackref":207},"#user-content-fnref-31","Back to reference 6",[1202],[109,1346,1203,1350],{"href":1347,"ariaLabel":1348,"className":1349,"dataFootnoteBackref":207},"#user-content-fnref-31-2","Back to reference 6-2",[1202],[719,1351,793],{},[563,1353,1355,1361,1362,1369,1370,1204,1375,1204,1382,1204,1389],{"id":1354},"user-content-fn-4",[109,1356,1359],{"href":1357,"rel":1358},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FWebSocket\u002Fextensions",[113],[102,1360,988],{}," is polyfilled using ",[109,1363,1366],{"href":1364,"rel":1365},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FHTTP\u002FProtocol_upgrade_mechanism#websocket-specific_headers",[113],[102,1367,1368],{},"sec-websocket-extensions"," request header. ",[109,1371,1203],{"href":1372,"ariaLabel":1373,"className":1374,"dataFootnoteBackref":207},"#user-content-fnref-4","Back to reference 7",[1202],[109,1376,1203,1380],{"href":1377,"ariaLabel":1378,"className":1379,"dataFootnoteBackref":207},"#user-content-fnref-4-2","Back to reference 7-2",[1202],[719,1381,793],{},[109,1383,1203,1387],{"href":1384,"ariaLabel":1385,"className":1386,"dataFootnoteBackref":207},"#user-content-fnref-4-3","Back to reference 7-3",[1202],[719,1388,828],{},[109,1390,1203,1394],{"href":1391,"ariaLabel":1392,"className":1393,"dataFootnoteBackref":207},"#user-content-fnref-4-4","Back to reference 7-4",[1202],[719,1395,868],{},[563,1397,1399,1361,1405,1369,1411,1204,1416,1204,1423,1204,1430,1204,1437,1204,1444],{"id":1398},"user-content-fn-5",[109,1400,1403],{"href":1401,"rel":1402},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FWebSocket\u002Fprotocol",[113],[102,1404,1035],{},[109,1406,1408],{"href":1364,"rel":1407},[113],[102,1409,1410],{},"sec-websocket-protocol",[109,1412,1203],{"href":1413,"ariaLabel":1414,"className":1415,"dataFootnoteBackref":207},"#user-content-fnref-5","Back to reference 8",[1202],[109,1417,1203,1421],{"href":1418,"ariaLabel":1419,"className":1420,"dataFootnoteBackref":207},"#user-content-fnref-5-2","Back to reference 8-2",[1202],[719,1422,793],{},[109,1424,1203,1428],{"href":1425,"ariaLabel":1426,"className":1427,"dataFootnoteBackref":207},"#user-content-fnref-5-3","Back to reference 8-3",[1202],[719,1429,828],{},[109,1431,1203,1435],{"href":1432,"ariaLabel":1433,"className":1434,"dataFootnoteBackref":207},"#user-content-fnref-5-4","Back to reference 8-4",[1202],[719,1436,868],{},[109,1438,1203,1442],{"href":1439,"ariaLabel":1440,"className":1441,"dataFootnoteBackref":207},"#user-content-fnref-5-5","Back to reference 8-5",[1202],[719,1443,917],{},[109,1445,1203,1449],{"href":1446,"ariaLabel":1447,"className":1448,"dataFootnoteBackref":207},"#user-content-fnref-5-6","Back to reference 8-6",[1202],[719,1450,929],{},[563,1452,1454,1460,1461,1204,1466],{"id":1453},"user-content-fn-6",[109,1455,1458],{"href":1456,"rel":1457},"https:\u002F\u002Fdeveloper.mozilla.org\u002Fen-US\u002Fdocs\u002FWeb\u002FAPI\u002FWebSocket\u002FreadyState",[113],[102,1459,1095],{}," is polyfilled by tracking open\u002Fclose events. ",[109,1462,1203],{"href":1463,"ariaLabel":1464,"className":1465,"dataFootnoteBackref":207},"#user-content-fnref-6","Back to reference 9",[1202],[109,1467,1203,1471],{"href":1468,"ariaLabel":1469,"className":1470,"dataFootnoteBackref":207},"#user-content-fnref-6-2","Back to reference 9-2",[1202],[719,1472,793],{},[563,1474,1476,1477,1480,1481,1484,1485,1491,1492,1204,1497],{"id":1475},"user-content-fn-7","Some runtimes have non standard values including ",[102,1478,1479],{},"\"nodebuffer\""," and ",[102,1482,1483],{},"\"uint8array\"",". crossws auto converts them for ",[109,1486,1488],{"href":1487},"\u002Fguide\u002Fmessage#messagedata",[102,1489,1490],{},"message.data",". ",[109,1493,1203],{"href":1494,"ariaLabel":1495,"className":1496,"dataFootnoteBackref":207},"#user-content-fnref-7","Back to reference 10",[1202],[109,1498,1203,1502],{"href":1499,"ariaLabel":1500,"className":1501,"dataFootnoteBackref":207},"#user-content-fnref-7-2","Back to reference 10-2",[1202],[719,1503,793],{},[1505,1506,1507],"style",{},"html pre.shiki code .so5gQ, html code.shiki .so5gQ{--shiki-light:#D73A49;--shiki-default:#F97583;--shiki-dark:#F97583}html pre.shiki code .sfrk1, html code.shiki .sfrk1{--shiki-light:#032F62;--shiki-default:#9ECBFF;--shiki-dark:#9ECBFF}html pre.shiki code .slsVL, html code.shiki .slsVL{--shiki-light:#24292E;--shiki-default:#E1E4E8;--shiki-dark:#E1E4E8}html pre.shiki code .shcOC, html code.shiki .shcOC{--shiki-light:#6F42C1;--shiki-default:#B392F0;--shiki-dark:#B392F0}html pre.shiki code .sQHwn, html code.shiki .sQHwn{--shiki-light:#E36209;--shiki-default:#FFAB70;--shiki-dark:#FFAB70}html pre.shiki code .suiK_, html code.shiki .suiK_{--shiki-light:#005CC5;--shiki-default:#79B8FF;--shiki-dark:#79B8FF}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 .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":207,"searchDepth":232,"depth":232,"links":1509},[1510,1520,1529,1530],{"id":95,"depth":232,"text":96,"children":1511},[1512,1513,1514,1515,1516,1517,1518,1519],{"id":100,"depth":244,"text":104},{"id":118,"depth":244,"text":121},{"id":144,"depth":244,"text":147},{"id":160,"depth":244,"text":163},{"id":187,"depth":244,"text":190},{"id":278,"depth":244,"text":281},{"id":287,"depth":244,"text":290},{"id":296,"depth":244,"text":299},{"id":331,"depth":232,"text":332,"children":1521},[1522,1523,1524,1525,1526,1527,1528],{"id":335,"depth":244,"text":338},{"id":344,"depth":244,"text":347},{"id":515,"depth":244,"text":518},{"id":527,"depth":244,"text":530},{"id":538,"depth":244,"text":541},{"id":549,"depth":244,"text":552},{"id":611,"depth":244,"text":608},{"id":625,"depth":232,"text":626},{"id":725,"depth":232,"text":1189},"Peer object allows easily interacting with connected clients.","md",{"icon":20},{"icon":20},{"title":17,"description":1531},"9UPcFhprTy0Fr98_zaL03zhggj_zPMuneKFO3i-5YBg",[1538,1540],{"title":12,"path":13,"stem":14,"description":1539,"icon":15,"children":-1},"Using hooks, you can define a WebSocket server that works across runtimes with the same syntax.",{"title":22,"path":23,"stem":24,"description":207,"icon":25,"children":-1},1782852618200]