amfUtils.js
function decodeAMF0Cmd(dbuf) {
    var buffer = dbuf;
    var resp = {};

    var cmd = amf0DecodeOne(buffer);
    resp.cmd = cmd.value;
    buffer = buffer.slice(cmd.len);

    if (rtmpCmdDecode[cmd.value]) {
        rtmpCmdDecode[cmd.value].forEach(function (n) {
            if (buffer.length > 0) {
                var r = amf0DecodeOne(buffer);
                buffer = buffer.slice(r.len);
                resp[n] = r.value;
            }
        });
    } else {
        console.log('Unknown command', resp);
    }
    return resp
}
function decodeAMF0Cmd(dbuf) {
    var buffer = dbuf;
    var resp = {};

    var cmd = amf0DecodeOne(buffer);
    resp.cmd = cmd.value;
    buffer = buffer.slice(cmd.len);

    if (rtmpCmdDecode[cmd.value]) {
        rtmpCmdDecode[cmd.value].forEach(function (n) {
            if (buffer.length > 0) {
                var r = amf0DecodeOne(buffer);
                buffer = buffer.slice(r.len);
                resp[n] = r.value;
            }
        });
    } else {
        console.log('Unknown command', resp);
    }
    return resp
}
function decodeAMF0Cmd ( dbuf ) { var buffer = dbuf ; var resp = { } ; var cmd = amf0DecodeOne ( buffer ) ; resp . cmd = cmd . value ; buffer = buffer . slice ( cmd . len ) ; if ( rtmpCmdDecode [ cmd . value ] ) { rtmpCmdDecode [ cmd . value ] . forEach ( function ( n ) { if ( buffer . length > 0 ) { var r = amf0DecodeOne ( buffer ) ; buffer = buffer . slice ( r . len ) ; resp [ n ] = r . value ; } } ) ; } else { console . log ( 'Unknown command' , resp ) ; } return resp }
Decode a command!
@param dbuf
@returns {{cmd: (*|string|String|*), value: *}}
Decode a command!