lib/KurentoClient.js
function encodeRpc(transaction, method, params, callback) {
    if (transaction)
      return transactionOperation.call(transaction, method, params,
        callback);

    var object = params.object;
    if (object && object.transactions && object.transactions.length) {
      var error = new TransactionNotCommitedException();
      error.method = method;
      error.params = params;

      return setTimeout(callback, 0, error)
    };

    for (var key in params.operationParams) {
      var object = params.operationParams[key];

      if (object && object.transactions && object.transactions.length) {
        var error = new TransactionNotCommitedException();
        error.method = method;
        error.params = params;

        return setTimeout(callback, 0, error)
      };
    }

    if (transactionsManager.length)
      return transactionOperation.call(transactionsManager, method, params,
        callback);

    var promise = new Promise(function (resolve, reject) {
      function callback2(error, result) {
        if (error) return reject(error);

        resolve(result);
      };

      prevRpc = deferred(params.object, params.operationParams, prevRpc,
          function (error) {
            if (error) throw error

            params = serializeParams(params);
            params.operationParams = serializeParams(params
              .operationParams);

            return encode(method, params, callback2);
          })
        .catch(reject)
    });

    prevRpc_result = promiseCallback(promise, callback);

    if (method == 'release') prevRpc = prevRpc_result;
  }
function encodeRpc(transaction, method, params, callback) {
    if (transaction)
      return transactionOperation.call(transaction, method, params,
        callback);

    var object = params.object;
    if (object && object.transactions && object.transactions.length) {
      var error = new TransactionNotCommitedException();
      error.method = method;
      error.params = params;

      return setTimeout(callback, 0, error)
    };

    for (var key in params.operationParams) {
      var object = params.operationParams[key];

      if (object && object.transactions && object.transactions.length) {
        var error = new TransactionNotCommitedException();
        error.method = method;
        error.params = params;

        return setTimeout(callback, 0, error)
      };
    }

    if (transactionsManager.length)
      return transactionOperation.call(transactionsManager, method, params,
        callback);

    var promise = new Promise(function (resolve, reject) {
      function callback2(error, result) {
        if (error) return reject(error);

        resolve(result);
      };

      prevRpc = deferred(params.object, params.operationParams, prevRpc,
          function (error) {
            if (error) throw error

            params = serializeParams(params);
            params.operationParams = serializeParams(params
              .operationParams);

            return encode(method, params, callback2);
          })
        .catch(reject)
    });

    prevRpc_result = promiseCallback(promise, callback);

    if (method == 'release') prevRpc = prevRpc_result;
  }
function encodeRpc ( transaction , method , params , callback ) { if ( transaction ) return transactionOperation . call ( transaction , method , params , callback ) ; var object = params . object ; if ( object && object . transactions && object . transactions . length ) { var error = new TransactionNotCommitedException ( ) ; error . method = method ; error . params = params ; return setTimeout ( callback , 0 , error ) } ; for ( var key in params . operationParams ) { var object = params . operationParams [ key ] ; if ( object && object . transactions && object . transactions . length ) { var error = new TransactionNotCommitedException ( ) ; error . method = method ; error . params = params ; return setTimeout ( callback , 0 , error ) } ; } if ( transactionsManager . length ) return transactionOperation . call ( transactionsManager , method , params , callback ) ; var promise = new Promise ( function ( resolve , reject ) { function callback2 ( error , result ) { if ( error ) return reject ( error ) ; resolve ( result ) ; } ; prevRpc = deferred ( params . object , params . operationParams , prevRpc , function ( error ) { if ( error ) throw error params = serializeParams ( params ) ; params . operationParams = serializeParams ( params . operationParams ) ; return encode ( method , params , callback2 ) ; } ) . catch ( reject ) } ) ; prevRpc_result = promiseCallback ( promise , callback ) ; if ( method == 'release' ) prevRpc = prevRpc_result ; }
Request a generic functionality to be procesed by the server
Request a generic functionality to be procesed by the server