src/simple-mqtt-client/client.js
function(client, subscriptions, channel, callback, done_callback) {
    if (subscriptions[channel]===undefined)
        return;
    subscriptions[channel].splice(subscriptions[channel].indexOf(callback), 1);
    if (subscriptions[channel].length===0) {
        delete subscriptions[channel];
        client.unsubscribe(channel, function() {
            // If there is a done_callback defined, execute it
            if (done_callback!==undefined) done_callback();
        });
    }
}
function(client, subscriptions, channel, callback, done_callback) {
    if (subscriptions[channel]===undefined)
        return;
    subscriptions[channel].splice(subscriptions[channel].indexOf(callback), 1);
    if (subscriptions[channel].length===0) {
        delete subscriptions[channel];
        client.unsubscribe(channel, function() {
            // If there is a done_callback defined, execute it
            if (done_callback!==undefined) done_callback();
        });
    }
}
function ( client , subscriptions , channel , callback , done_callback ) { if ( subscriptions [ channel ] === undefined ) return ; subscriptions [ channel ] . splice ( subscriptions [ channel ] . indexOf ( callback ) , 1 ) ; if ( subscriptions [ channel ] . length === 0 ) { delete subscriptions [ channel ] ; client . unsubscribe ( channel , function ( ) { // If there is a done_callback defined, execute it if ( done_callback !== undefined ) done_callback ( ) ; } ) ; } }
Helper function that unsubscribes from a channel in node
Helper function that unsubscribes from a channel in node