rCMD/go/win.go

31 lines
429 B
Go
Raw Normal View History

2023-11-15 03:44:41 +00:00
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
})
}
}