MCPcopy Create free account
hub / github.com/cloudflare/computer / acceptWebSocketSession

Function acceptWebSocketSession

packages/rpc/src/server.ts:344–349  ·  view source on GitHub ↗
(
  ws: WebSocket | { addEventListener: WebSocket["addEventListener"] },
  rpc: SyncRPC | ShellRPC | WorkspaceRPC,
)

Source from the content-addressed store, hash-verified

342// (WHATWG EventTarget) and node `ws` package server sockets, which
343// share the addEventListener / send / close subset capnweb needs.
344export function acceptWebSocketSession(
345 ws: WebSocket | { addEventListener: WebSocket["addEventListener"] },
346 rpc: SyncRPC | ShellRPC | WorkspaceRPC,
347): void {
348 newWebSocketRpcSession(ws as unknown as WebSocket, rpc as unknown as RpcTarget);
349}
350
351// Serve a single capnweb HTTP-batch session against a SyncRPC. Wraps
352// capnweb's nodeHttpBatchRpcResponse so computerd never directly imports

Callers 5

createHTTPServerFunction · 0.90
handleConnectFunction · 0.90
startHarnessFunction · 0.85
startShellHarnessFunction · 0.85
startCompositeHarnessFunction · 0.85

Calls

no outgoing calls

Tested by 3

startHarnessFunction · 0.68
startShellHarnessFunction · 0.68
startCompositeHarnessFunction · 0.68