------------------------------------------------------------------------------ Channel returns a Go channel for concurrently receiving messages. The channel is closed together with the PubSub. If the Go channel is blocked full for 1 minute the message is dropped. Receive* APIs can not be used after
(opts ...ChannelOption)
| 570 | // go-redis periodically sends ping messages to test connection health |
| 571 | // and re-subscribes if ping can not received for 1 minute. |
| 572 | func (c *PubSub) Channel(opts ...ChannelOption) <-chan *Message { |
| 573 | c.chOnce.Do(func() { |
| 574 | c.msgCh = newChannel(c, opts...) |
| 575 | c.msgCh.initMsgChan() |
| 576 | }) |
| 577 | if c.msgCh == nil { |
| 578 | err := fmt.Errorf("redis: Channel can't be called after ChannelWithSubscriptions") |
| 579 | panic(err) |
| 580 | } |
| 581 | return c.msgCh.msgCh |
| 582 | } |
| 583 | |
| 584 | // ChannelSize is like Channel, but creates a Go channel |
| 585 | // with specified buffer size. |