32 lines
432 B
Go
32 lines
432 B
Go
package main
|
|
|
|
import (
|
|
"github.com/go-redis/redis/v7"
|
|
)
|
|
|
|
func main() {
|
|
client := redis.NewClient(&redis.Options{
|
|
Addr: "10.1.3.100:6379",
|
|
Password: "",
|
|
DB: 0,
|
|
})
|
|
|
|
_, err := client.Ping().Result()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
channel := client.Subscribe("qq")
|
|
_, err = channel.Receive()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
for msg := range channel.Channel() {
|
|
if msg.Channel != "qq" {
|
|
return
|
|
}
|
|
|
|
}
|
|
}
|