MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / writeSseEvent

Function writeSseEvent

packages/codex-native-api/src/native_api_server.ts:3003–3009  ·  view source on GitHub ↗
(response: ServerResponse, payload: JsonRecord)

Source from the content-addressed store, hash-verified

3001}
3002
3003function 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
3011function writeSseData(response: ServerResponse, payload: JsonRecord): void {
3012 if (response.writableEnded || response.destroyed) {

Callers 1

flushEventsMethod · 0.85

Calls 2

writeMethod · 0.80
normalizeStringFunction · 0.70

Tested by

no test coverage detected