about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorBen Lubar <ben.lubar@gmail.com>2020-01-24 13:51:33 -0600
committerEugen Rochko <eugen@zeonfederated.com>2020-01-24 20:51:33 +0100
commit0dfba0884e8885cf242010e0d9da6b328b3560a6 (patch)
tree9712770831d46872bc284171e4b6f8e8bbfa51b6 /streaming
parent14ca559705285432f06d9343dc2d00c0b009184b (diff)
minor server-sent events fixes (#12945)
* Send output on the server-sent events stream immediately so the client sees that it was successfully opened even if it doesn't have any messages.

Fix transparent SSE streaming for the public:local and hashtag:local stream types.

* Tell caches to never store server-sent events.
Diffstat (limited to 'streaming')
-rw-r--r--streaming/index.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 304e7e046..0a19c74a6 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -436,8 +436,11 @@ const startWorker = (workerId) => {
     const accountId = req.accountId || req.remoteAddress;
 
     res.setHeader('Content-Type', 'text/event-stream');
+    res.setHeader('Cache-Control', 'no-store');
     res.setHeader('Transfer-Encoding', 'chunked');
 
+    res.write(':)\n');
+
     const heartbeat = setInterval(() => res.write(':thump\n'), 15000);
 
     req.on('close', () => {