MCPcopy Index your code
hub / github.com/bigskysoftware/_hyperscript / readStream

Function readStream

www/js/_hyperscript-max.js:11796–11821  ·  view source on GitHub ↗
(stub, reader, ac)

Source from the content-addressed store, hash-verified

11794 });
11795 }
11796 async function readStream(stub, reader, ac) {
11797 stub.reader = reader;
11798 var baseDelay = 500;
11799 try {
11800 for await (var msg of parseSSE(reader)) {
11801 if (ac.signal.aborted) break;
11802 if (msg.id) stub.lastEventId = msg.id;
11803 if (msg.retry != null) baseDelay = msg.retry;
11804 var eventType = msg.event || "message";
11805 var evt = {
11806 type: eventType,
11807 data: msg.data,
11808 lastEventId: msg.id || stub.lastEventId || ""
11809 };
11810 dispatch(stub, eventType, evt);
11811 }
11812 } catch (err) {
11813 if (!ac.signal.aborted) {
11814 dispatch(stub, "error", { type: "error", error: err });
11815 }
11816 }
11817 stub.reader = null;
11818 if (!stub.closed && !ac.signal.aborted) {
11819 scheduleReconnect(stub, baseDelay);
11820 }
11821 }
11822 function scheduleReconnect(stub, baseDelay) {
11823 if (stub.closed) return;
11824 baseDelay = baseDelay || 500;

Callers 1

startConnectionFunction · 0.70

Calls 3

parseSSEFunction · 0.70
dispatchFunction · 0.70
scheduleReconnectFunction · 0.70

Tested by

no test coverage detected