MCPcopy Create free account
hub / github.com/block/buzz / resolveHandler

Function resolveHandler

desktop/src/testing/e2eBridge.ts:2746–2761  ·  view source on GitHub ↗
(handler: unknown)

Source from the content-addressed store, hash-verified

2744}
2745
2746function resolveHandler(handler: unknown): WsHandler {
2747 if (typeof handler === "function") {
2748 return handler as WsHandler;
2749 }
2750
2751 if (
2752 typeof handler === "object" &&
2753 handler !== null &&
2754 "onmessage" in handler &&
2755 typeof handler.onmessage === "function"
2756 ) {
2757 return handler.onmessage as WsHandler;
2758 }
2759
2760 throw new Error("Invalid websocket message handler.");
2761}
2762
2763function sendWsText(handler: WsHandler, payload: unknown[]) {
2764 handler({

Callers 2

connectRealSocketFunction · 0.85
connectMockSocketFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected