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

Function connectMockSocket

desktop/src/testing/e2eBridge.ts:7371–7389  ·  view source on GitHub ↗
(args: { onMessage: unknown })

Source from the content-addressed store, hash-verified

7369}
7370
7371async function connectMockSocket(args: { onMessage: unknown }) {
7372 if (mockWebsocketSendMutexWedged) {
7373 return new Promise<number>(() => {});
7374 }
7375
7376 const wsId = nextSocketId++;
7377 const handler = resolveHandler(args.onMessage);
7378
7379 mockSockets.set(wsId, {
7380 handler,
7381 subscriptions: new Map(),
7382 });
7383
7384 window.setTimeout(() => {
7385 sendWsText(handler, ["AUTH", `mock-challenge-${wsId}`]);
7386 }, 0);
7387
7388 return wsId;
7389}
7390
7391async function sendToRealSocket(args: {
7392 id: number;

Callers 1

handleMockCommandFunction · 0.85

Calls 3

resolveHandlerFunction · 0.85
sendWsTextFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected