---
description: Workers can export a connect() handler to accept TCP connections forwarded from another Worker over a service binding.
title: Connect handler no longer requires an experimental flag
image: https://developers.cloudflare.com/changelog/post/2026-08-18-connect-handler/og.png?v=ccffb5f0495ea6c3
---

[Skip to content](#main-content)

[View RSS feeds](https://developers.cloudflare.com/fundamentals/new-features/available-rss-feeds/) [ Subscribe to RSS](https://developers.cloudflare.com/changelog/rss/index.xml)

[Back to all posts](https://developers.cloudflare.com/changelog)

August 18, 2026

## Connect handler no longer requires an experimental flag

[Workers](https://developers.cloudflare.com/workers/)

Copy as Markdown| [View as Markdown](https://developers.cloudflare.com/changelog/post/2026-08-18-connect-handler/index.md)| [Agent setup](https://developers.cloudflare.com/agent-setup/)

Workers can now export a [`connect()` handler](https://developers.cloudflare.com/workers/runtime-apis/handlers/connect/) without enabling any [compatibility flag](https://developers.cloudflare.com/workers/configuration/compatibility-flags/). Previously, using a `connect()` handler required the `experimental` compatibility flag, which cannot be enabled in production.

A `connect()` handler lets a Worker accept a TCP connection forwarded from another Worker over a [service binding](https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/), and read and write raw bytes on it using a [`Socket`](https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/#socket) object:

*backend-worker.jsjs*

```js
export default {
	async connect(socket, env, ctx) {
		const writer = socket.writable.getWriter();
		await writer.write(new TextEncoder().encode("hello"));
		await writer.close();
	},
};
```

Another Worker forwards a connection to it by calling `connect()` on the service binding:

*frontend-worker.jsjs*

```js
export default {
	async fetch(request, env) {
		const socket = env.BACKEND.connect("example.com:1234");
		return new Response(socket.readable);
	},
};
```

On the `connect()` handler side, `socket.opened` resolves with `localAddress` set to the address the caller passed to `connect()`.

Direct inbound TCP connections remain unsupported at present.

For more information, refer to the [connect handler documentation](https://developers.cloudflare.com/workers/runtime-apis/handlers/connect/).

```json
{"@context":"https://schema.org","@type":"BlogPosting","@id":"https://developers.cloudflare.com/changelog/post/2026-08-18-connect-handler/#page","headline":"Connect handler no longer requires an experimental flag","description":"Workers can export a connect() handler to accept TCP connections forwarded from another Worker over a service binding.","url":"https://developers.cloudflare.com/changelog/post/2026-08-18-connect-handler/","inLanguage":"en","image":"https://developers.cloudflare.com/changelog/post/2026-08-18-connect-handler/og.png?v=ccffb5f0495ea6c3","dateModified":"2026-08-18","datePublished":"2026-08-18","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
