src/simple-mqtt-client/client-browser.js
function subscribeBrowser (client, subscriptions, backlog, channel, callback, done_callback) {
    if ( addToBacklog(client, backlog, subscribeBrowser, [client, subscriptions, backlog, channel, callback, done_callback]) ) return;
    if (subscriptions[channel]===undefined) {
        subscriptions[channel] = [callback];
        client.subscribe(channel, {qos: 0, onSuccess: function() {
            // If there is a done_callback defined, execute it
            if (done_callback!==undefined) done_callback();
        }});
    } else {
        subscriptions[channel].push(callback);
        // If there is a done_callback defined, execute it
        if (done_callback!==undefined) done_callback();
    }
}
function subscribeBrowser (client, subscriptions, backlog, channel, callback, done_callback) {
    if ( addToBacklog(client, backlog, subscribeBrowser, [client, subscriptions, backlog, channel, callback, done_callback]) ) return;
    if (subscriptions[channel]===undefined) {
        subscriptions[channel] = [callback];
        client.subscribe(channel, {qos: 0, onSuccess: function() {
            // If there is a done_callback defined, execute it
            if (done_callback!==undefined) done_callback();
        }});
    } else {
        subscriptions[channel].push(callback);
        // If there is a done_callback defined, execute it
        if (done_callback!==undefined) done_callback();
    }
}
function subscribeBrowser ( client , subscriptions , backlog , channel , callback , done_callback ) { if ( addToBacklog ( client , backlog , subscribeBrowser , [ client , subscriptions , backlog , channel , callback , done_callback ] ) ) return ; if ( subscriptions [ channel ] === undefined ) { subscriptions [ channel ] = [ callback ] ; client . subscribe ( channel , { qos : 0 , onSuccess : function ( ) { // If there is a done_callback defined, execute it if ( done_callback !== undefined ) done_callback ( ) ; } } ) ; } else { subscriptions [ channel ] . push ( callback ) ; // If there is a done_callback defined, execute it if ( done_callback !== undefined ) done_callback ( ) ; } }
Helper function that subscribes to a channel in the browser
Helper function that subscribes to a channel in the browser