function createDefaultCloudflareWebSocketHost
Since 0.2.0
createDefaultCloudflareWebSocketHost(): CloudflareWebSocketHost

Builds the default host from the real Workers globals.

Exported as a factory rather than a constant so the boundary cast is only evaluated when an upgrade actually happens, and so a unit test can call it directly to cover the default path.

Return Type

A host backed by the WebSocketPair global

Throws

Error

If WebSocketPair is not available in the current runtime

Usage

import { createDefaultCloudflareWebSocketHost } from "runtime/src/index.ts";