SOCKET.ionic
Parent
import { getParentWorker } from "https://deno.land/x/worker_ionic/mod.ts";
const worker = getParentWorker({
url: new URL("./worker.ts", import.meta.url).href,
pingTimeout: 1000,
pingInterval: 100,
});
const event = worker.on("ping", (data) => {
console.log(data);
});
worker.remove("ping", event);
worker.emit("channel", { potatoes: "smashed" });
Child
import { getChildWorker } from "https://deno.land/x/worker_ionic/mod.ts";
const worker = getChildWorker();
const event = worker.on("ping", (data) => {
console.log(data);
});
worker.remove("ping", event);
worker.emit("channel", { potatoes: "smashed" });