- commit
- a549d7ec148a43c9e80fea34626d0447e0c298fc
- parent
- b019e05dbe9f06e8310e220f1724a1ed8dd7d737
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-10-15 09:33
use hmsg
Diffstat
M | static/via.js | 4 | ++-- |
1 files changed, 2 insertions, 2 deletions
diff --git a/static/via.js b/static/via.js
@@ -1,13 +1,13 @@ 1 1 var baseUrl = 'https://via.ce9e.org/'; 2 2 3 3 export var send = function(key, data) {4 -1 var url = baseUrl + 'msg/' + key;-1 4 var url = baseUrl + 'hmsg/' + key; 5 5 var body = JSON.stringify(data); 6 6 return fetch(url, {method: 'POST', body: body}); 7 7 }; 8 8 9 9 export var listen = function(key, fn) {10 -1 var evtSource = new EventSource(baseUrl + 'msg/' + key);-1 10 var evtSource = new EventSource(baseUrl + 'hmsg/' + key); 11 11 evtSource.onmessage = msg => fn(JSON.parse(msg.data)); 12 12 evtSource.onopen = () => fn([null, 'open']); 13 13 };