(payload: string)
| 68 | } |
| 69 | |
| 70 | function createRawSseResponse(payload: string): Response { |
| 71 | return new Response( |
| 72 | new ReadableStream<Uint8Array>({ |
| 73 | start(controller) { |
| 74 | controller.enqueue(new TextEncoder().encode(payload)) |
| 75 | controller.close() |
| 76 | }, |
| 77 | }), |
| 78 | { |
| 79 | status: 200, |
| 80 | headers: { |
| 81 | 'Content-Type': 'text/event-stream', |
| 82 | }, |
| 83 | } |
| 84 | ) |
| 85 | } |
| 86 | |
| 87 | function createStreamingContext(): StreamingContext { |
| 88 | return { |