code: func (m *MMClient) StatusLoop() {
  	retries := 0
  	backoff := time.Second * 60
  	if m.OnWsConnect != nil {
  		m.OnWsConnect()
  	}
  	m.logger.Debug("StatusLoop:", m.OnWsConnect != nil)
  	for {
  		if m.WsQuit {
  			return
  		}
  		if m.WsConnected {
  			if err := m.checkAlive(); err != nil {
  				m.logger.Errorf("Connection is not alive: %#v", err)
  			}
  			select {
  			case <-m.WsPingChan:
  				m.logger.Debug("WS PONG received")
  				backoff = time.Second * 60
  			case <-time.After(time.Second * 5):
  				if retries > 3 {
  					m.logger.Debug("StatusLoop() timeout")
  					m.Logout()
  					m.WsQuit = false
  					err := m.Login()
  					if err != nil {
  						m.logger.Errorf("Login failed: %#v", err)
  						break
  					}
  					if m.OnWsConnect != nil {
  						m.OnWsConnect()
  					}
  					go m.WsReceiver()
  				} else {
  					retries++
  					backoff = time.Second * 5
  				}
  			}
  		}
  		time.Sleep(backoff)
  	}
  }
docs: // StatusLoop implements a ping-cycle that ensures that the connection to the chat servers
  // remains alive. In case of a disconnect it will try to reconnect. A call to this method
  // is blocking until the 'WsQuite' field of the MMClient object is set to 'true'.