syndicate-js/todo/syntax-playground/src/avahipublish.js

19 lines
662 B
JavaScript
Raw Normal View History

const { Observe, currentFacet, genUuid } = require("@syndicate-lang/core");
const M = activate require("@syndicate-lang/driver-mdns");
spawn named 'test' {
const svc = M.Service((new Date()).toJSON(), '_syndicate+testing._tcp');
assert M.Publish(svc, null, 8001, []);
2018-12-12 17:16:10 +00:00
field this.count = 0;
2019-05-15 16:26:39 +00:00
dataflow console.log('Service count:', this.count);
2018-12-12 17:16:10 +00:00
during M.Discovered(M.Service($name, '_syndicate+testing._tcp'),
$host, $port, _, $addr, "IPv4", $ifName)
2021-01-16 16:46:18 +00:00
=>
{
on start { this.count++; console.log('+', name, host, port, addr, ifName); }
on stop { this.count--; console.log('-', name, host, port, addr, ifName); }
}
}