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 controller = new AbortController();
|
||||
internalStreamCache[streamID] = {
|
||||
url,
|
||||
service: obj.service,
|
||||
headers: obj.headers,
|
||||
controller: new AbortController(),
|
||||
controller,
|
||||
dispatcher
|
||||
};
|
||||
|
||||
let streamLink = new URL('/api/istream', `http://127.0.0.1:${env.apiPort}`);
|
||||
streamLink.searchParams.set('id', streamID);
|
||||
|
||||
const cleanup = () => {
|
||||
destroyInternalStream(streamLink);
|
||||
controller.signal.removeEventListener('abort', cleanup);
|
||||
}
|
||||
|
||||
controller.signal.addEventListener('abort', cleanup);
|
||||
|
||||
return streamLink.toString();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user