MCPcopy Create free account
hub / github.com/astercloud/aster / handleSSEChunk

Function handleSSEChunk

examples/plan-explore-ui/static/main.js:118–133  ·  view source on GitHub ↗
(chunk, uiState)

Source from the content-addressed store, hash-verified

116 }
117
118 function handleSSEChunk(chunk, uiState) {
119 const lines = chunk.split("\n");
120 for (const line of lines) {
121 if (!line.startsWith("data:")) continue;
122 const json = line.slice(5).trim();
123 if (!json) continue;
124 let evt;
125 try {
126 evt = JSON.parse(json);
127 } catch (e) {
128 console.warn("Failed to parse event JSON", e);
129 continue;
130 }
131 renderUIEvent(evt, uiState);
132 }
133 }
134
135 function renderUIEvent(ev, uiState) {
136 if (!ev || !ev.channel || !ev.type) return;

Callers 1

pumpFunction · 0.85

Calls 2

renderUIEventFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected