client.go
func (c *Client) IdleWithFallback(stop <-chan struct{}, pollInterval time.Duration) error {
	if ok, err := c.SupportIdle(); err != nil {
		return err
	} else if ok {
		return c.Idle(stop)
	}

	if pollInterval == 0 {
		pollInterval = defaultPollInterval
	}

	t := time.NewTicker(pollInterval)
	defer t.Stop()

	for {
		select {
		case <-t.C:
			if err := c.c.Noop(); err != nil {
				return err
			}
		case <-stop:
			return nil
		case <-c.c.LoggedOut():
			return errors.New("disconnected while idling")
		}
	}
}
func (c *Client) IdleWithFallback(stop <-chan struct{}, pollInterval time.Duration) error {
	if ok, err := c.SupportIdle(); err != nil {
		return err
	} else if ok {
		return c.Idle(stop)
	}

	if pollInterval == 0 {
		pollInterval = defaultPollInterval
	}

	t := time.NewTicker(pollInterval)
	defer t.Stop()

	for {
		select {
		case <-t.C:
			if err := c.c.Noop(); err != nil {
				return err
			}
		case <-stop:
			return nil
		case <-c.c.LoggedOut():
			return errors.New("disconnected while idling")
		}
	}
}
func ( c * Client ) IdleWithFallback ( stop <- chan struct { } , pollInterval time . Duration ) error { if ok , err := c . SupportIdle ( ) ; err != nil { return err } else if ok { return c . Idle ( stop ) } if pollInterval == 0 { pollInterval = defaultPollInterval } t := time . NewTicker ( pollInterval ) defer t . Stop ( ) for { select { case <- t . C : if err := c . c . Noop ( ) ; err != nil { return err } case <- stop : return nil case <- c . c . LoggedOut ( ) : return errors . New ( " " ) } } }
// IdleWithFallback tries to idle if the server supports it. If it doesn't, it
// falls back to polling. If pollInterval is zero, a sensible default will be
// used.
IdleWithFallback tries to idle if the server supports it . If it doesn t it falls back to polling . If pollInterval is zero a sensible default will be used .