sincecutoff.com
← all changes

wrangler dev supports raw socket connect triggers

Introduced 2026-08-20 · score 0.98

HOW TO USE IT

When configuring raw TCP connections for local development, enable the `experimental` compatibility flag and add a `connect` trigger; `wrangler dev` forwards connections to the Worker’s `connect(socket, env, ctx)` handler. [Release note](https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.125.0)

{ "compatibility_flags": ["experimental"], "connect": [{ "protocol": "tcp", "port": 5432 }] }
import { defineWorker, triggers } from "@cloudflare/config"; export default defineWorker({ triggers: [ triggers.connect({ protocol: "tcp", port: 5432, address: "127.0.0.1" }), ], });
npx wrangler dev

WHY THIS HELPS

Configure a Worker to handle raw TCP connections during local development.

REQUIREMENTS AND LIMITATIONS

  • Version: 4.125.0
  • compatibility_flags: "experimental" (required): Required compatibility flag for the connect trigger.
  • connect[].protocol (required): Protocol to listen for; only `"tcp"` is supported.
  • connect[].port (required): Port for the listening socket. The example uses `5432`.
  • connect[].address: Listening address; defaults to `127.0.0.1`.
  • triggers.connect(...): `@cloudflare/config` declaration that lowers to the `connect` field.
  • Requires the `experimental` compatibility flag.
  • Only `"tcp"` is supported at the moment.
  • Each entry listens on `127.0.0.1` unless an `address` is given.
  • Connections bypass the local dev HTTP entry point.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card