code: function unsubscribe() {
    console.log('Unsubscribing client ' + clientId + ' from topic: ' + topics.subscribe);
    if (isSubscribed === true) {
      client.unsubscribe(topics.subscribe, function () {
        console.log('sucessfully unsubscribed');
        isSubscribed = false;
      });
    }
  }
docs: unsubscribe Unsubscribes from your topics
  mqttControls.unsubscribe()