MCPcopy
hub / github.com/simstudioai/sim / createSseResponse

Function createSseResponse

apps/sim/lib/copilot/request/go/stream.test.ts:51–68  ·  view source on GitHub ↗
(events: unknown[])

Source from the content-addressed store, hash-verified

49import type { ExecutionContext, StreamingContext } from '@/lib/copilot/request/types'
50
51function createSseResponse(events: unknown[]): Response {
52 const payload = events.map((event) => `data: ${JSON.stringify(event)}\n\n`).join('')
53
54 return new Response(
55 new ReadableStream<Uint8Array>({
56 start(controller) {
57 controller.enqueue(new TextEncoder().encode(payload))
58 controller.close()
59 },
60 }),
61 {
62 status: 200,
63 headers: {
64 'Content-Type': 'text/event-stream',
65 },
66 }
67 )
68}
69
70function createRawSseResponse(payload: string): Response {
71 return new Response(

Callers 1

stream.test.tsFile · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected