diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2020-02-01 17:34:26 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2020-02-01 17:34:26 +0000 |
| commit | 16d3cae5d3c3b03cbce26e0c897b28102a86795a (patch) | |
| tree | fc18eb870c6047b95da817865c551b846db01a15 /lib | |
| parent | modularize (diff) | |
| download | alive-16d3cae5d3c3b03cbce26e0c897b28102a86795a.tar.gz alive-16d3cae5d3c3b03cbce26e0c897b28102a86795a.zip | |
add osc
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/osc.moon | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/osc.moon b/lib/osc.moon new file mode 100644 index 0000000..a99aab0 --- /dev/null +++ b/lib/osc.moon @@ -0,0 +1,21 @@ +import Op from require 'base' +import pack, unpack from require 'osc' +import dns, udp from require 'socket' + +class out extends Op + new: (...) => + super ... + + @@udp or= udp! + + setup: (@host, @port, @path, @value) => + + update: => + ip = dns.toip @host\get! + port = @port\get! + msg = pack @path\get!, @value\get! + @@udp\sendto msg, ip, port + +{ + :out +} |
