aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/sse_worker.js
blob: 78e4aa51b14d1a1aaf684f6e32c6e9c95e4c09d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);

}