@dainprotocol/tunnel 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.js +4 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -454,6 +454,10 @@ class DainTunnelServer {
|
|
|
454
454
|
'Content-Encoding': 'identity', // Prevent compression middleware from buffering
|
|
455
455
|
'Transfer-Encoding': 'chunked' // Ensure chunked encoding for streaming
|
|
456
456
|
});
|
|
457
|
+
// CRITICAL: Flush headers immediately to establish SSE connection
|
|
458
|
+
// Without this, Node.js may buffer the headers, causing browser timeout
|
|
459
|
+
res.flushHeaders();
|
|
460
|
+
console.log(`[Tunnel Server] SSE headers flushed for ${sseId}`);
|
|
457
461
|
console.log(`[Tunnel Server] SSE headers written for ${sseId}`);
|
|
458
462
|
// Send initial connection event - MUST be sent immediately to prevent browser timeout
|
|
459
463
|
res.write(': keepalive\n\n');
|