rCMD/go/win.go
2023-11-15 11:44:41 +08:00

31 lines
429 B
Go

package main
import (
"fmt"
"os"
"github.com/r3labs/sse/v2"
)
func main() {
println("Hello, World!")
device_id := os.Getenv("DEVICE_ID")
if device_id == "" {
println("DEVICE_ID env is not set")
os.Exit(1)
}
for {
client := sse.NewClient("https://ivampiresp.com/wp-content/rCMD/sse.php?device=" + device_id)
client.Subscribe("message", func(msg *sse.Event) {
fmt.Println(msg.Data)
// json
})
}
}