code: func (c *Client) processSubscribe(pkt *packet.Subscribe) error {
  	// acquire subscribe token
  	select {
  	case <-c.subscribeTokens:
  		// continue
  	case <-time.After(c.TokenTimeout):
  		return c.die(ClientError, ErrTokenTimeout)
  	case <-c.tomb.Dying():
  		return tomb.ErrDying
  	}
  
  	// prepare suback packet
  	suback := packet.NewSuback()
  	suback.ReturnCodes = make([]packet.QOS, len(pkt.Subscriptions))
  	suback.ID = pkt.ID
  
  	// set granted qos
  	for i, subscription := range pkt.Subscriptions {
  		suback.ReturnCodes[i] = subscription.QOS
  	}
  
  	// subscribe client to queue
  	err := c.backend.Subscribe(c, pkt.Subscriptions, func() {
  		select {
  		case c.ackQueue <- suback:
  		case <-c.tomb.Dying():
  		}
  	})
  	if err != nil {
  		return c.die(BackendError, err)
  	}
  
  	return nil
  }
docs: // handle an incoming subscribe packet