code: func (k *Kite) SetupKontrolClient() error {
  	if k.kontrol.Client != nil {
  		return nil // already prepared
  	}
  
  	if k.Config.KontrolURL == "" {
  		return errors.New("no kontrol URL given in config")
  	}
  
  	client := k.NewClient(k.Config.KontrolURL)
  	client.Kite = protocol.Kite{Name: "kontrol"} // for logging purposes
  	client.Auth = &Auth{
  		Type: "kiteKey",
  		Key:  k.KiteKey(),
  	}
  
  	k.kontrol.Lock()
  	k.kontrol.Client = client
  	k.kontrol.Unlock()
  
  	k.kontrol.OnConnect(func() {
  		k.Log.Info("Connected to Kontrol")
  		k.Log.Debug("Connected to Kontrol with session %q", client.session.ID())
  
  		// try to re-register on connect
  		k.kontrol.Lock()
  		if k.kontrol.lastRegisteredURL != nil {
  			select {
  			case k.kontrol.registerChan <- k.kontrol.lastRegisteredURL:
  			default:
  			}
  		}
  		k.kontrol.Unlock()
  
  		// signal all other methods that are listening on this channel, that we
  		// are connected to kontrol.
  		k.kontrol.onceConnected.Do(func() { close(k.kontrol.readyConnected) })
  	})
  
  	k.kontrol.OnDisconnect(func() {
  		k.Log.Warning("Disconnected from Kontrol.")
  	})
  
  	// non blocking, is going to reconnect if the connection goes down.
  	if _, err := k.kontrol.DialForever(); err != nil {
  		return err
  	}
  
  	return nil
  }
docs: // SetupKontrolClient setups and prepares a the kontrol instance. It connects
  // to kontrol and reconnects again if there is any disconnections. This method
  // is called internally whenever a kontrol client specific action is taking.
  // However if you wish to connect earlier you may call this method.