Skip to content

Commit

Permalink
doc: reword about PubSub in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rueian committed Mar 31, 2022
1 parent 930f483 commit f9edc63
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ err = c.Receive(context.Background(), c.B().Subscribe().Channel("ch1", "ch2").Bu
})
```

The provided message handler will be called once message is received.
The provided handler will be called with received message.

It is important to note that `Client.Receive()` will block and then return value only when the following cases:
1. `nil`, when received any unsubscribe/punsubscribe message related to the provided `subscribe` command.
2. `rueidis.ErrClosing`, when the client is closed manually.
3. `ctx.Err()`, when the deadline of `ctx` is exceeded.
It is important to note that `Client.Receive()` will keep blocking and return only when the following cases:
1. return `nil`, when received any unsubscribe/punsubscribe message related to the provided `subscribe` command.
2. return `rueidis.ErrClosing`, when the client is closed manually.
3. return `ctx.Err()`, when the `ctx` is done.

While the `Client.Receive()` call is blocking, the `Client` is still able to accept other concurrent requests,
and they are sharing the same tcp connection. If your message handler may take some time to complete, it is recommended
Expand Down

0 comments on commit f9edc63

Please sign in to comment.