MCPcopy Create free account
hub / github.com/acking-you/static_flow / openSessionEventStream

Function openSessionEventStream

crates/frontend/gpt2api-app/src/api.ts:223–236  ·  view source on GitHub ↗
(
  sessionId: string,
  key: string,
  options: RequestOptions = {},
)

Source from the content-addressed store, hash-verified

221}
222
223export async function openSessionEventStream(
224 sessionId: string,
225 key: string,
226 options: RequestOptions = {},
227): Promise<ReadableStream<Uint8Array>> {
228 const response = await fetch(`${API_BASE}/sessions/${encodeURIComponent(sessionId)}/events`, {
229 headers: { authorization: `Bearer ${key}` },
230 signal: options.signal,
231 });
232 if (!response.ok || !response.body) {
233 throw new Error(`event stream failed: HTTP ${response.status}`);
234 }
235 return response.body;
236}
237
238export function getShare(token: string) {
239 return fetch(`${API_BASE}/share/${encodeURIComponent(token)}`).then(async (response) => {

Callers 1

connectEventsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected