2018-12-02 17:48:58 +00:00
|
|
|
const { Observe, currentFacet, genUuid } = require("@syndicate-lang/core");
|
|
|
|
const M = activate require("@syndicate-lang/driver-mdns");
|
|
|
|
|
|
|
|
spawn named 'test' {
|
2019-05-31 12:58:04 +00:00
|
|
|
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
|
|
|
|
2019-05-31 12:58:04 +00:00
|
|
|
during M.Discovered(M.Service($name, '_syndicate+testing._tcp'),
|
|
|
|
$host, $port, _, $addr, "IPv4", $ifName)
|
2021-01-16 16:46:18 +00:00
|
|
|
=>
|
2018-12-02 17:48:58 +00:00
|
|
|
{
|
2019-05-31 12:58:04 +00:00
|
|
|
on start { this.count++; console.log('+', name, host, port, addr, ifName); }
|
|
|
|
on stop { this.count--; console.log('-', name, host, port, addr, ifName); }
|
2018-12-02 17:48:58 +00:00
|
|
|
}
|
|
|
|
}
|