Generalize socket cancellation and update API accordingly

This commit is contained in:
2021-10-23 18:03:17 -07:00
parent ef4bad94b5
commit e198b769f9
9 changed files with 211 additions and 76 deletions

28
cmd/test/main.go Normal file
View File

@@ -0,0 +1,28 @@
package main
import (
"fmt"
"time"
"go.arsenm.dev/itd/api"
)
func main() {
itd, _ := api.New(api.DefaultAddr)
defer itd.Close()
fmt.Println(itd.Address())
mCh, cancel, _ := itd.WatchMotion()
go func() {
time.Sleep(10 * time.Second)
cancel()
fmt.Println("canceled")
}()
for m := range mCh {
fmt.Println(m)
}
}