code: func (c *Client) processPacket(pkt packet.Generic) error {
  	// prepare error
  	var err error
  
  	// handle individual packets
  	switch typedPkt := pkt.(type) {
  	case *packet.Subscribe:
  		err = c.processSubscribe(typedPkt)
  	case *packet.Unsubscribe:
  		err = c.processUnsubscribe(typedPkt)
  	case *packet.Publish:
  		err = c.processPublish(typedPkt)
  	case *packet.Puback:
  		err = c.processPubackAndPubcomp(typedPkt.ID)
  	case *packet.Pubcomp:
  		err = c.processPubackAndPubcomp(typedPkt.ID)
  	case *packet.Pubrec:
  		err = c.processPubrec(typedPkt.ID)
  	case *packet.Pubrel:
  		err = c.processPubrel(typedPkt.ID)
  	case *packet.Pingreq:
  		err = c.processPingreq()
  	case *packet.Disconnect:
  		err = c.processDisconnect()
  	default:
  		err = c.die(ClientError, ErrUnexpectedPacket)
  	}
  
  	// return eventual error
  	if err != nil {
  		return err // error has already been handled
  	}
  
  	return nil
  }
docs: // handle an incoming Generic