<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>Cloudflare changelogs | Spectrum</title><description>Cloudflare changelogs for Spectrum</description><link>https://developers.cloudflare.com/changelog/</link><item><title>Spectrum - Redesigned Spectrum dashboard</title><link>https://developers.cloudflare.com/changelog/post/2026-11-19-redesigned-dashboard/</link><guid isPermaLink="true">https://developers.cloudflare.com/changelog/post/2026-11-19-redesigned-dashboard/</guid><description>&lt;p&gt;The Spectrum pages in the Cloudflare dashboard have been redesigned. Your existing applications and their settings do not change.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Spectrum Applications&lt;/strong&gt; page lists each application&apos;s type, edge port, origin, and edge IP type, with the last minute of connections, ingress, and egress. You can search the list and sort it by column.&lt;/p&gt;
&lt;p&gt;Creating or editing an application now opens a full page instead of a modal, with settings grouped into &lt;strong&gt;Application Configuration&lt;/strong&gt;, &lt;strong&gt;Origin Configuration&lt;/strong&gt;, and &lt;strong&gt;Advanced Options&lt;/strong&gt;. To edit an application, select its hostname, or select the three dots next to it &amp;gt; &lt;strong&gt;Edit&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;You can now create and edit applications that use &lt;a href=&quot;https://developers.cloudflare.com/spectrum/about/static-ip/&quot;&gt;static IPs&lt;/a&gt; or &lt;a href=&quot;https://developers.cloudflare.com/spectrum/about/byoip/&quot;&gt;BYOIP&lt;/a&gt; addresses in the dashboard. Under &lt;strong&gt;Edge IP Type&lt;/strong&gt;, select &lt;strong&gt;Dedicated IPs&lt;/strong&gt;. Leave &lt;strong&gt;Subdomain&lt;/strong&gt; blank to create an application on the zone apex.&lt;/p&gt;
&lt;p&gt;New TCP and UDP applications created in the dashboard now have &lt;strong&gt;IP Access Rules&lt;/strong&gt; turned off by default, which matches the API default. To enforce IP Access rules for an application, turn on &lt;strong&gt;IP Access Rules&lt;/strong&gt; under &lt;strong&gt;Advanced Options&lt;/strong&gt;. Existing applications keep their current setting.&lt;/p&gt;
&lt;p&gt;To create your first application, refer to &lt;a href=&quot;https://developers.cloudflare.com/spectrum/get-started/&quot;&gt;Get started with Spectrum&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To share feedback on the redesigned dashboard, complete &lt;a href=&quot;https://forms.gle/BW9RoXZpgx7B5HZC6&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;this form&lt;span class=&quot;external-link&quot;&gt; ↗︎&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Thu, 19 Nov 2026 00:00:00 GMT</pubDate><product>Spectrum</product><category>Spectrum</category></item><item><title>Spectrum, Containers, Durable Objects, Workers - Inbound TCP and gRPC for Workers and Containers now in public beta</title><link>https://developers.cloudflare.com/changelog/post/2026-11-19-inbound-tcp/</link><guid isPermaLink="true">https://developers.cloudflare.com/changelog/post/2026-11-19-inbound-tcp/</guid><description>
&lt;p&gt;Inbound TCP connections to Workers and bidirectional gRPC in Containers are now in public beta.&lt;/p&gt;
&lt;p&gt;Worker-origin Spectrum applications are available on Pro and Business zones, and on Enterprise zones with Spectrum Enterprise enabled. Without Spectrum Enterprise, Pro and Business zones support one Worker-origin application per zone, on one TCP port.&lt;/p&gt;
&lt;pre class=&quot;mermaid&quot;&gt;flowchart LR
    Client[TCP client] &amp;lt;--&amp;gt; Spectrum
    Spectrum &amp;lt;--&amp;gt; Worker[&quot;Worker connect()&amp;lt;br/&amp;gt;Handle or forward bytes&quot;]
    Worker &amp;lt;--&amp;gt; DO[&quot;Durable Object&amp;lt;br/&amp;gt;connect()&quot;]
    DO &amp;lt;--&amp;gt; Container[&quot;Container&amp;lt;br/&amp;gt;gRPC or other TCP server&quot;]
&lt;/pre&gt;
&lt;div tabindex=&quot;-1&quot; class=&quot;heading-wrapper level-h4&quot;&gt;&lt;h4 id=&quot;forward-a-worker-socket-to-a-durable-object&quot;&gt;Forward a Worker socket to a Durable Object&lt;/h4&gt;&lt;a class=&quot;anchor-link&quot; href=&quot;#forward-a-worker-socket-to-a-durable-object&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;anchor-icon&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;path fill=&quot;currentcolor&quot; d=&quot;m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Spectrum sends public TCP connections to your Worker&apos;s &lt;code&gt;connect()&lt;/code&gt; handler. The Worker opens a socket to the &lt;code&gt;GrpcContainer&lt;/code&gt; Durable Object and pipes bytes in both directions:&lt;/p&gt;
&lt;div&gt;&lt;div data-nb-tabs data-nb-sync-key=&quot;workersExamples&quot; class&gt;&lt;div class=&quot;relative flex border-b border-border&quot; role=&quot;tablist&quot; data-nb-tabs-list&gt;&lt;span class=&quot;bg-primary pointer-events-none absolute -bottom-px h-0.5 rounded-t-sm transition-[left,width] duration-200 ease-out&quot; data-nb-tabs-indicator aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;mt-3&quot;&gt;&lt;div role=&quot;tabpanel&quot; data-nb-tabs-content data-nb-tab-label=&quot;JavaScript&quot; class&gt;&lt;figure class=&quot;nb-code-figure nb-code-figure-titled&quot; data-nb-lang=&quot;js&quot;&gt;&lt;figcaption class=&quot;nb-code-title&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span class=&quot;nb-code-title-name&quot;&gt;src/index.js&lt;/span&gt;&lt;span class=&quot;nb-code-title-lang&quot;&gt;js&lt;/span&gt;&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz&quot; tabindex=&quot;0&quot; data-language=&quot;js&quot; data-nb-lang=&quot;js&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; default&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;	async&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; connect&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; container&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; env.&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;GRPC_CONTAINER&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;getByName&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;grpc-demo&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; durableObjectSocket&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; container.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;grpc-container:50051&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			allowHalfOpen: &lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			secureTransport: &lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;off&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		try&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; durableObjectSocket.opened;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				socket.readable.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;pipeTo&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(durableObjectSocket.writable),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				durableObjectSocket.readable.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;pipeTo&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(socket.writable),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		} &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;allSettled&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([socket.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(), durableObjectSocket.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;()]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;&lt;div role=&quot;tabpanel&quot; data-nb-tabs-content data-nb-tab-label=&quot;TypeScript&quot; class&gt;&lt;figure class=&quot;nb-code-figure nb-code-figure-titled&quot; data-nb-lang=&quot;ts&quot;&gt;&lt;figcaption class=&quot;nb-code-title&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span class=&quot;nb-code-title-name&quot;&gt;src/index.ts&lt;/span&gt;&lt;span class=&quot;nb-code-title-lang&quot;&gt;ts&lt;/span&gt;&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz&quot; tabindex=&quot;0&quot; data-language=&quot;ts&quot; data-nb-lang=&quot;ts&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; default&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;	async&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; connect&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; Socket&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; Env&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; container&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; env.&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;GRPC_CONTAINER&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;getByName&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;grpc-demo&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; durableObjectSocket&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; container.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;grpc-container:50051&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			allowHalfOpen: &lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			secureTransport: &lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;off&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		try&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; durableObjectSocket.opened;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				socket.readable.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;pipeTo&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(durableObjectSocket.writable),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				durableObjectSocket.readable.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;pipeTo&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(socket.writable),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		} &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;allSettled&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([socket.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(), durableObjectSocket.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;()]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;} &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;satisfies&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; ExportedHandler&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;Env&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;script type=&quot;module&quot; src=&quot;https://developers.cloudflare.com/opt/buildhome/repo/src/components/ui/tabs/Tabs.astro?astro&amp;type=script&amp;index=0&amp;lang.ts&quot;&gt;&lt;/script&gt;&lt;/div&gt;
&lt;div tabindex=&quot;-1&quot; class=&quot;heading-wrapper level-h4&quot;&gt;&lt;h4 id=&quot;forward-the-durable-object-socket-to-its-container&quot;&gt;Forward the Durable Object socket to its Container&lt;/h4&gt;&lt;a class=&quot;anchor-link&quot; href=&quot;#forward-the-durable-object-socket-to-its-container&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;anchor-icon&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;path fill=&quot;currentcolor&quot; d=&quot;m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;The Durable Object receives the connection in its own &lt;code&gt;connect()&lt;/code&gt; handler. Once its Container is running, &lt;code&gt;getTcpPort(50051).connect()&lt;/code&gt; opens a socket to the gRPC server inside it:&lt;/p&gt;
&lt;div&gt;&lt;div data-nb-tabs data-nb-sync-key=&quot;workersExamples&quot; class&gt;&lt;div class=&quot;relative flex border-b border-border&quot; role=&quot;tablist&quot; data-nb-tabs-list&gt;&lt;span class=&quot;bg-primary pointer-events-none absolute -bottom-px h-0.5 rounded-t-sm transition-[left,width] duration-200 ease-out&quot; data-nb-tabs-indicator aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;mt-3&quot;&gt;&lt;div role=&quot;tabpanel&quot; data-nb-tabs-content data-nb-tab-label=&quot;JavaScript&quot; class&gt;&lt;figure class=&quot;nb-code-figure nb-code-figure-titled&quot; data-nb-lang=&quot;js&quot;&gt;&lt;figcaption class=&quot;nb-code-title&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span class=&quot;nb-code-title-name&quot;&gt;src/index.js&lt;/span&gt;&lt;span class=&quot;nb-code-title-lang&quot;&gt;js&lt;/span&gt;&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz&quot; tabindex=&quot;0&quot; data-language=&quot;js&quot; data-nb-lang=&quot;js&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; { DurableObject } &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt; &quot;cloudflare:workers&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; class&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; GrpcContainer&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; extends&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; DurableObject&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;	async&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; connect&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; containerSocket&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; this&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.ctx.container&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;getTcpPort&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;50051&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;10.0.0.1:50051&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				allowHalfOpen: &lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				secureTransport: &lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;off&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		try&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; containerSocket.opened;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				socket.readable.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;pipeTo&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(containerSocket.writable),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				containerSocket.readable.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;pipeTo&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(socket.writable),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		} &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;allSettled&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([socket.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(), containerSocket.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;()]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;&lt;div role=&quot;tabpanel&quot; data-nb-tabs-content data-nb-tab-label=&quot;TypeScript&quot; class&gt;&lt;figure class=&quot;nb-code-figure nb-code-figure-titled&quot; data-nb-lang=&quot;ts&quot;&gt;&lt;figcaption class=&quot;nb-code-title&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span class=&quot;nb-code-title-name&quot;&gt;src/index.ts&lt;/span&gt;&lt;span class=&quot;nb-code-title-lang&quot;&gt;ts&lt;/span&gt;&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz&quot; tabindex=&quot;0&quot; data-language=&quot;ts&quot; data-nb-lang=&quot;ts&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; { DurableObject } &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt; &quot;cloudflare:workers&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;export&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; class&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; GrpcContainer&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; extends&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; DurableObject&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;Env&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;	async&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; connect&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; Socket&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; containerSocket&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; this&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.ctx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			.container&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;getTcpPort&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;50051&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;connect&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;10.0.0.1:50051&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				allowHalfOpen: &lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				secureTransport: &lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;off&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;		try&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; containerSocket.opened;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;all&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				socket.readable.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;pipeTo&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(containerSocket.writable),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				containerSocket.readable.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;pipeTo&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(socket.writable),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		} &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;			await&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; Promise&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;allSettled&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([socket.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(), containerSocket.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;close&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;()]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;allowHalfOpen: true&lt;/code&gt; preserves TCP half-closes. The Worker and Durable Object forward encrypted bytes; the Container terminates TLS and handles HTTP/2 and gRPC.&lt;/p&gt;
&lt;div tabindex=&quot;-1&quot; class=&quot;heading-wrapper level-h4&quot;&gt;&lt;h4 id=&quot;run-bidirectional-grpc-in-the-container&quot;&gt;Run bidirectional gRPC in the Container&lt;/h4&gt;&lt;a class=&quot;anchor-link&quot; href=&quot;#run-bidirectional-grpc-in-the-container&quot;&gt;&lt;span aria-hidden=&quot;true&quot; class=&quot;anchor-icon&quot;&gt;&lt;svg width=&quot;16&quot; height=&quot;16&quot; viewBox=&quot;0 0 24 24&quot;&gt;&lt;path fill=&quot;currentcolor&quot; d=&quot;m12.11 15.39-3.88 3.88a2.52 2.52 0 0 1-3.5 0 2.47 2.47 0 0 1 0-3.5l3.88-3.88a1 1 0 0 0-1.42-1.42l-3.88 3.89a4.48 4.48 0 0 0 6.33 6.33l3.89-3.88a1 1 0 1 0-1.42-1.42Zm8.58-12.08a4.49 4.49 0 0 0-6.33 0l-3.89 3.88a1 1 0 0 0 1.42 1.42l3.88-3.88a2.52 2.52 0 0 1 3.5 0 2.47 2.47 0 0 1 0 3.5l-3.88 3.88a1 1 0 1 0 1.42 1.42l3.88-3.89a4.49 4.49 0 0 0 0-6.33ZM8.83 15.17a1 1 0 0 0 1.1.22 1 1 0 0 0 .32-.22l4.92-4.92a1 1 0 0 0-1.42-1.42l-4.92 4.92a1 1 0 0 0 0 1.42Z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Run an existing gRPC server in any language, including services for real-time voice applications. This Node.js snippet shows the streaming handler and service registration. It sends a greeting, echoes incoming messages, and sends a final response when the client finishes:&lt;/p&gt;
&lt;figure class=&quot;nb-code-figure nb-code-figure-titled&quot; data-nb-lang=&quot;js&quot;&gt;&lt;figcaption class=&quot;nb-code-title&quot; data-pagefind-ignore=&quot;&quot;&gt;&lt;span class=&quot;nb-code-title-name&quot;&gt;container/server.js&lt;/span&gt;&lt;span class=&quot;nb-code-title-lang&quot;&gt;js&lt;/span&gt;&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz&quot; tabindex=&quot;0&quot; data-language=&quot;js&quot; data-nb-lang=&quot;js&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; path&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; require&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;node:path&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; grpc&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; require&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;@grpc/grpc-js&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; protoLoader&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; require&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;@grpc/proto-loader&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; definition&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; protoLoader.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;loadSync&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	path.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;resolve&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(__dirname, &lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;../proto/bytes.proto&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; proto&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; grpc.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;loadPackageDefinition&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(definition).cloudflare.grpcdemo;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt; chat&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;call&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;	let&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	call.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		payload: Buffer.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;hello from the container gRPC server&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	call.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;data&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, ({ &lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;payload&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; }) &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		count &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;+=&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		call.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			payload: Buffer.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;concat&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				Buffer.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;`container echo ${&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;}: `&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;				payload,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			]),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	call.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;end&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, () &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		call.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;			payload: Buffer.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;goodbye from the container gRPC server&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;		call.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;	call.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;error&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, (&lt;/span&gt;&lt;span class=&quot;nb-shiki-1jdh33&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;) &lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; console.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb-shiki-mdbnqw&quot;&gt;&quot;gRPC stream error&quot;&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;, error));&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;nb-shiki-dzsirb&quot;&gt; server&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; =&lt;/span&gt;&lt;span class=&quot;nb-shiki-1itgoe&quot;&gt; new&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt; grpc.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;Server&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;server.&lt;/span&gt;&lt;span class=&quot;nb-shiki-1t8gfj&quot;&gt;addService&lt;/span&gt;&lt;span class=&quot;nb-shiki-140thh&quot;&gt;(proto.ByteStream.service, { Chat: chat });&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Follow the &lt;a href=&quot;https://developers.cloudflare.com/containers/examples/bidirectional-grpc/&quot;&gt;complete gRPC example&lt;/a&gt; for the protobuf definition, bindings, Spectrum routing, Secrets Store TLS credentials, and Container startup and readiness checks.&lt;/p&gt;</description><pubDate>Thu, 19 Nov 2026 00:00:00 GMT</pubDate><product>Spectrum</product><category>Spectrum</category><category>Containers</category><category>Durable Objects</category><category>Workers</category></item></channel></rss>