package main import ( "fmt" "log" "math/rand" "time" "github.com/ably/ably-go/ably" ) func main() { opt := &ably.ClientOptions{} opt.Key = "kY92tg.1qo8DQ:CS755GfXwEGtBiIr" a, err := ably.NewRealtimeClient(opt) panicIfErr(err) chn := a.Channels.Get("test") for { log.Println("Sending:") chn.Publish("test", fmt.Sprintf("Hello: %d", rand.Intn(10))) <-time.After(2 * time.Second) } } func panicIfErr(err error) { if err != nil { panic(err) } }