delphimvcframework/samples/pushnotifications_server/bin/www/myworkers.js

22 lines
482 B
JavaScript
Raw Normal View History

2016-11-07 14:32:57 +01:00
importScripts('ajax.js')
var ajax = new AJAX();
var clientid = null;
function loop() {
ajax.get('/topics/test1/' + clientid, function(status, response) {
if (status == 200) {
//console.log(response);
var json = JSON.parse(response);
//console.log(json);
self.postMessage(json);
setTimeout(loop, 500);
}
});
}
self.onmessage = function(event) {
self.clientid = event.data;
self.loop();
}