src/simple-mqtt-client/client-browser.js
function findCallbacks (subscriptions, channel) {
    // First try to see if a callback for the exact channel exists
    if(Object.keys(subscriptions).indexOf(channel)!==-1)
        return subscriptions[channel];
    // If it doesn't then let's try to see if the channel matches a wildcard callback
    var pattern = matchesWildcard(subscriptions, channel);
    if (pattern!== undefined) {
        return subscriptions[pattern];
    }
    // If there's no exact match or wildcard we have to return undefined
    return undefined;
}
function findCallbacks (subscriptions, channel) {
    // First try to see if a callback for the exact channel exists
    if(Object.keys(subscriptions).indexOf(channel)!==-1)
        return subscriptions[channel];
    // If it doesn't then let's try to see if the channel matches a wildcard callback
    var pattern = matchesWildcard(subscriptions, channel);
    if (pattern!== undefined) {
        return subscriptions[pattern];
    }
    // If there's no exact match or wildcard we have to return undefined
    return undefined;
}
function findCallbacks ( subscriptions , channel ) { // First try to see if a callback for the exact channel exists if ( Object . keys ( subscriptions ) . indexOf ( channel ) !== - 1 ) return subscriptions [ channel ] ; // If it doesn't then let's try to see if the channel matches a wildcard callback var pattern = matchesWildcard ( subscriptions , channel ) ; if ( pattern !== undefined ) { return subscriptions [ pattern ] ; } // If there's no exact match or wildcard we have to return undefined return undefined ; }
Helper function that selects the right callback when a message is received
Helper function that selects the right callback when a message is received