Added test to show why this change in mosca:

-    var qos = Math.min((options && options.qos) || 0,
-                       client.subscriptions[topic]);
+    var qos = Math.min(
+            (options && options.qos) || 0,
+            client.subscriptions[
+                    (sub_topic && sub_topic.replace("*", "#")) || topic] || 0);

and therefore this change in ascoltatori:

+      handler = null,
+      cb = null;
+
+    cb = function (pub_topic, payload, options) {
+      callback(pub_topic, payload, options, topic);
+    };

are necessary. Otherwise, subscriptions qos levels aren't retrieved correctly
(get from the topic in the message rather than the subscribed topic).