Use onNet
function when you want to listen from server AND from client.
This declares an event which gets triggered with emit (from server) or emitNet (from client).
function onNet(eventName: string, fn: Function) => void
onNet(
"myResource:doMassiveStuff",
(heavyArg: Array<string>) => {
heavyArg = heavyArg.map(val => val + ".");
// Note that source is accessible when the even is called from a client.
// Read more on emit on the dedicated emit page
emit("myResource:returnMassiveStuff", source, heavyArg);
}
);