MCPcopy Create free account
hub / github.com/ShipSecAI/studio / send

Method send

backend/src/workflows/workflows.controller.ts:896–916  ·  view source on GitHub ↗
(event: string, payload: unknown)

Source from the content-addressed store, hash-verified

894 let latestEventTimestamp: number | null = null;
895
896 const send = (event: string, payload: unknown) => {
897 if (!active) {
898 return;
899 }
900 try {
901 res.write(`event: ${event}\n`);
902 res.write(`data: ${JSON.stringify(payload)}\n\n`);
903 // Flush headers if available (helps with immediate delivery)
904 if (typeof (res as any).flush === 'function') {
905 (res as any).flush();
906 }
907 } catch (error) {
908 // Connection closed or error writing
909 console.warn(`Failed to send SSE event ${event}:`, error);
910 if (!active) {
911 return;
912 }
913 active = false;
914 void cleanup();
915 }
916 };
917
918 const cleanup = async () => {
919 if (!active) {

Callers 7

handleGatewayMethod · 0.80
appendMethod · 0.80
publishMethod · 0.80
recordMethod · 0.80
sendRawMethod · 0.80
saveFunction · 0.80

Calls 2

cleanupFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected