-- Periodically broadcasts (id, label) to the router so label-addressed -- packets can be resolved network-wide. Skips machines with no label. local createNet = require("/apis/net") -- TOFIX: the idea of this file is to dynamically listen the computerLabel so in fact "os.getComputerLabel" should be called inside refresh() local label = os.getComputerLabel() if not label then return end local net = createNet() local el = net.eventloop -- In the future we might want to consider to have core events like computer-label-changed (at os level) local REFRESH_SECONDS = 30 local function refresh() -- Note: I don't like "router.register" and net-registrar naming here -- I think what we want here is a sort of hack to get an event computer_label_changed that will be used by the router directly, so maybe move this directly in `startup` dir ? net.send("router.register", { label = label }) el.setTimeout(refresh, REFRESH_SECONDS) end el.onStart(refresh)