mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 19:28:29 +00:00
who knows :-3
This commit is contained in:
parent
2ab1a01e91
commit
5834c714cf
@ -78,16 +78,25 @@ export function createInternalStream(url, obj = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const streamID = nanoid();
|
const streamID = nanoid();
|
||||||
|
const controller = new AbortController();
|
||||||
internalStreamCache[streamID] = {
|
internalStreamCache[streamID] = {
|
||||||
url,
|
url,
|
||||||
service: obj.service,
|
service: obj.service,
|
||||||
headers: obj.headers,
|
headers: obj.headers,
|
||||||
controller: new AbortController(),
|
controller,
|
||||||
dispatcher
|
dispatcher
|
||||||
};
|
};
|
||||||
|
|
||||||
let streamLink = new URL('/api/istream', `http://127.0.0.1:${env.apiPort}`);
|
let streamLink = new URL('/api/istream', `http://127.0.0.1:${env.apiPort}`);
|
||||||
streamLink.searchParams.set('id', streamID);
|
streamLink.searchParams.set('id', streamID);
|
||||||
|
|
||||||
|
const cleanup = () => {
|
||||||
|
destroyInternalStream(streamLink);
|
||||||
|
controller.signal.removeEventListener('abort', cleanup);
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.signal.addEventListener('abort', cleanup);
|
||||||
|
|
||||||
return streamLink.toString();
|
return streamLink.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user