Cloudflare Workers support the following protocols and interfaces:
| Protocol | Inbound | Outbound |
|---|---|---|
| HTTP / HTTPS | Handle incoming HTTP requests using the fetch() handler. |
Make HTTP subrequests using the fetch() API. |
| Direct TCP sockets | Handle TCP connections forwarded over a service binding or through a Spectrum application using the connect() handler (public beta). |
Create outbound TCP connections using the connect() API. |
| gRPC | Route gRPC, including bidirectional streams, through Spectrum to a Worker and Cloudflare Container (public beta). | — |
| WebSockets | Accept incoming WebSocket connections using the WebSocket API. |
— |
| HTTP/3 (QUIC) | Accept inbound requests over HTTP/3 ↗︎ by enabling it on your zone in Speed > Settings > Protocol Optimization in the Cloudflare dashboard ↗︎. | — |
| SMTP | Use Email Workers to process and forward email without managing TCP connections to SMTP email servers. | Use Email Workers. |
For gRPC, the Worker receives the connection as a raw TCP byte stream. In this path, the Worker does not parse gRPC or HTTP/2 frames. It forwards the stream to a gRPC server running in a Container. Refer to Bidirectional gRPC with Workers and Containers for a complete example.