(response: ServerResponse, payload: JsonRecord)
| 3001 | } |
| 3002 | |
| 3003 | function writeSseEvent(response: ServerResponse, payload: JsonRecord): void { |
| 3004 | if (response.writableEnded || response.destroyed) { |
| 3005 | return; |
| 3006 | } |
| 3007 | const eventName = normalizeString(payload.type) || 'message'; |
| 3008 | response.write(`event: ${eventName}\ndata: ${JSON.stringify(payload)}\n\n`); |
| 3009 | } |
| 3010 | |
| 3011 | function writeSseData(response: ServerResponse, payload: JsonRecord): void { |
| 3012 | if (response.writableEnded || response.destroyed) { |
no test coverage detected