1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Improve API.

This commit is contained in:
Vladimir Mihailenco
2013-09-29 09:37:09 +03:00
parent 8d6a169007
commit e90db6f494
3 changed files with 35 additions and 32 deletions

View File

@ -112,18 +112,19 @@ func ExamplePubSub() {
})
defer client.Close()
pubsub, err := client.PubSubClient()
pubsub := client.PubSub()
defer pubsub.Close()
err = pubsub.Subscribe("mychannel")
err := pubsub.Subscribe("mychannel")
_ = err
msg, err := pubsub.Receive(0)
msg, err := pubsub.Receive()
fmt.Println(msg, err)
pub := client.Publish("mychannel", "hello")
_ = pub.Err()
msg, err = pubsub.Receive(0)
msg, err = pubsub.Receive()
fmt.Println(msg, err)
// Output: &{subscribe mychannel 1} <nil>