Workers Cotonic
Cotonic uses Web Workers which all run in separate calling context. This means that they will not block the main user interface thread. They are also truly isolated from each other. This means that a crash or another kind of problem in worker A can't crash worker B.
You can run whatever code you like in workers, with some exceptions. You can't access the DOM, and a lot of things from the window object. This also makes them more secure because you don't have to worry that worker code from an external resource can steal the a credit-card number entered somewhere in the DOM tree.
Cotonic adds a MQTT like publish subscribe mechanism to the standard javascript web worker api. This makes it easy for web workers to communicate with each other.
// worker-a
"use strict";
self.subscribe("some/topic", function(message) {
self.publish("model/ui/update", "<p>Worker A got message</p>")
});
self.publish("model/ui/insert", "<p>Worker A started</p>");
// worker-b
"use strict";
self.subscribe("some/topic", function(message) {
self.publish("model/ui/update", "<p>Worker B got message</p>")
});
self.publish("model/ui/insert", "<p>Worker B started</p>");
let worker_a = cotonic.spawn("worker-a.js", [1, 2]);
let worker_a = cotonic.spawn("worker-b.js");
cotonic.broker.publish("some/topic", "hello workers!");