diff options
Diffstat (limited to 'extra/push-examples/go/index.go')
-rw-r--r-- | extra/push-examples/go/index.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/extra/push-examples/go/index.go b/extra/push-examples/go/index.go new file mode 100644 index 0000000..2e518e7 --- /dev/null +++ b/extra/push-examples/go/index.go @@ -0,0 +1,20 @@ +package main + +import ( + "fmt" + "net/http" + "time" +) + +func main() { + const PushURL = "https://example.com/api/push/key?status=up&msg=OK&ping=" + const Interval = 60 + + for { + _, err := http.Get(PushURL) + if err == nil { + fmt.Println("Pushed!") + } + time.Sleep(Interval * time.Second) + } +} |