Skip to content

Some others examples with Total.js

GeoCloud edited this page Sep 26, 2014 · 1 revision

Interaction between WebWorker-Controller-WebSocket:

// DEFINTION worker.on('message', function(obj) { //console.log('CallWorker: ' + obj); framework.global.cron_job = obj; framework.emit('custom-worker', obj); });

// CONTROLLER function some_websocket_action() { var self = this; var handler = function(obj) { self.send(obj); }; framework.on('custom-worker', handler); self.on('destroy', function() { framework.removeListener('custom-worker', handler); });

}

Clone this wiki locally