Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/workers-testing-miniflare-websockets-workflow-guide.mdA 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.textA 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.textA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. 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