(pubSub *PubSub, opts ...ChannelOption)
| 693 | } |
| 694 | |
| 695 | func newChannel(pubSub *PubSub, opts ...ChannelOption) *channel { |
| 696 | c := &channel{ |
| 697 | pubSub: pubSub, |
| 698 | |
| 699 | chanSize: 100, |
| 700 | chanSendTimeout: time.Minute, |
| 701 | checkInterval: 3 * time.Second, |
| 702 | pingTimeout: 5 * time.Second, |
| 703 | reconnectTimeout: 10 * time.Second, |
| 704 | } |
| 705 | for _, opt := range opts { |
| 706 | opt(c) |
| 707 | } |
| 708 | if c.checkInterval > 0 { |
| 709 | c.initHealthCheck() |
| 710 | } |
| 711 | return c |
| 712 | } |
| 713 | |
| 714 | func (c *channel) initHealthCheck() { |
| 715 | c.ping = make(chan struct{}, 1) |
no test coverage detected