aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/sse_worker.js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-11-11 21:30:38 +0100
committerMax Kostikov <max@kostikov.co>2019-11-11 21:30:38 +0100
commitb033597ada02ef045bc9fbdb2237f81935b73e47 (patch)
treeecc8af0a821436c576e01627ee3c76c6c8ba254d /view/js/sse_worker.js
parent89342ca9fbf329d5e84839c51f26db19bdd4ac8c (diff)
downloadvolse-hubzilla-b033597ada02ef045bc9fbdb2237f81935b73e47.tar.gz
volse-hubzilla-b033597ada02ef045bc9fbdb2237f81935b73e47.tar.bz2
volse-hubzilla-b033597ada02ef045bc9fbdb2237f81935b73e47.zip
sse notifications
Diffstat (limited to 'view/js/sse_worker.js')
-rwxr-xr-xview/js/sse_worker.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/view/js/sse_worker.js b/view/js/sse_worker.js
new file mode 100755
index 000000000..78e4aa51b
--- /dev/null
+++ b/view/js/sse_worker.js
@@ -0,0 +1,14 @@
+var evtSource = new EventSource('/sse');
+
+onconnect = function(e) {
+
+ var port = e.ports[0];
+
+ port.start();
+
+ evtSource.addEventListener('notifications', function(e) {
+ var obj = JSON.parse(e.data);
+ port.postMessage(obj);
+ }, false);
+
+}