cloudflare · Cloudflare Workers Docs
Workers WebSockets
Implements WebSocket server functionality within a Miniflare environment by responding with a 101 Switching Protocols status and a webSocket property on the Response object.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Workers WebSockets
Implements WebSocket server functionality within a Miniflare environment by responding with a 101 Switching Protocols status and a webSocket property on the Response object.
When To Use
Use when you need to implement or test WebSocket server logic and connection upgrades within a Miniflare local development environment.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/workers-testing-miniflare-websockets-workflow-guide.md | A guide explaining how Miniflare handles WebSocket upgrades and provides an example of a Worker implementing an echo server. | Questions about a guide explaining how Miniflare handles WebSocket upgrades and provides an example of a Worker implementing an echo... |
examples/workers-testing-miniflare-websockets-cloudflare-workers-miniflare-websoc.text | A JavaScript code example demonstrating how to implement and test WebSocket pairs within a Cloudflare Workers environment using Miniflare. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to implement and test WebSocket pairs within a Cloudflare Workers environ... |
examples/workers-testing-miniflare-websockets-cloudflare-workers-miniflare-websoc-2.text | A JavaScript code snippet demonstrating how to use Miniflare to dispatch a fetch request with a WebSocket upgrade header to test Workers WebSocket functionality. | Exact payloads, commands, or snippets shown in A JavaScript code snippet demonstrating how to use Miniflare to dispatch a fetch request with a WebSocket upgrade hea... |
What This Skill Covers
- Miniflare will always upgrade Web Socket connections. The Worker must respond with a status 101 Switching Protocols response including a webSocket. For examp...
- Main sections:
Server.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.cloudflare.com/workers/testing/miniflare/core/web-sockets/index.md
