diff options
author | Mario <mario@mariovavti.com> | 2019-11-11 21:30:38 +0100 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-11-11 21:30:38 +0100 |
commit | b033597ada02ef045bc9fbdb2237f81935b73e47 (patch) | |
tree | ecc8af0a821436c576e01627ee3c76c6c8ba254d /view/js/sse_worker.js | |
parent | 89342ca9fbf329d5e84839c51f26db19bdd4ac8c (diff) | |
download | volse-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-x | view/js/sse_worker.js | 14 |
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); + +} |