MCPcopy Create free account
hub / github.com/bywwcnll/StreamPanel / flushBuffer

Function flushBuffer

inject.js:388–406  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

386 };
387
388 const flushBuffer = () => {
389 if (!buffer.trim()) {
390 buffer = '';
391 return;
392 }
393
394 if (isSSE) {
395 const events = parseSSEEvents(buffer + '\n\n');
396 for (const event of events) {
397 emitMessage(event.event, event.data, event.id);
398 }
399 } else if (isNDJSON) {
400 const lines = buffer.split(/\r?\n/).filter(line => line.trim());
401 for (const line of lines) {
402 emitMessage('message', line);
403 }
404 }
405 buffer = '';
406 };
407
408 const shouldObserveStream = (stream) => {
409 if (!activeStream) {

Callers 1

closeConnectionFunction · 0.85

Calls 2

parseSSEEventsFunction · 0.85
emitMessageFunction · 0.85

Tested by

no test coverage detected