u
This commit is contained in:
@@ -552,14 +552,19 @@ export function register(app, basePath = '') {
|
||||
res.setTimeout?.(0);
|
||||
req.socket?.setNoDelay(true);
|
||||
|
||||
res.setHeader('Content-Type', 'text/event-stream');
|
||||
res.setHeader('Cache-Control', 'no-cache, no-transform');
|
||||
res.setHeader('Connection', 'keep-alive');
|
||||
res.setHeader('X-Accel-Buffering', 'no');
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/event-stream',
|
||||
'Cache-Control': 'no-cache, no-transform',
|
||||
'Connection': 'keep-alive',
|
||||
'X-Accel-Buffering': 'no',
|
||||
});
|
||||
if (typeof res.flushHeaders === 'function') {
|
||||
res.flushHeaders();
|
||||
}
|
||||
|
||||
// Initial ping to establish frame through any proxy
|
||||
res.write(': ping\n\n');
|
||||
|
||||
req.on('close', () => {
|
||||
console.warn(`[Company Import SSE] Client request closed (writableEnded: ${res.writableEnded}, destroyed: ${res.destroyed})`);
|
||||
});
|
||||
@@ -584,6 +589,7 @@ export function register(app, basePath = '') {
|
||||
}
|
||||
res.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
|
||||
if (typeof res.flush === 'function') res.flush();
|
||||
if (typeof req.socket?.uncork === 'function') req.socket.uncork();
|
||||
};
|
||||
|
||||
sseWrite('status', { message: 'Import gestartet. Daten werden verarbeitet...' });
|
||||
|
||||
Reference in New Issue
Block a user