method IDurableObjectState.acceptWebSocket
IDurableObjectState.acceptWebSocket(ws: IDurableObjectWebSocket): void

Accepts a socket as hibernatable.

Unlike ws.accept(), this tells the runtime it need not pin the Durable Object to memory while the connection is open: the object may be evicted and its constructor re-run when the next message arrives. That is why RealtimeBackplaneObjectCore keeps no membership in a field — getWebSockets is the only state that survives.

Parameters

The server half of the pair

Return Type

void

Usage

import { type IDurableObjectState } from "cloudflare-plugin/src/index.ts";