Wrap the original event handler.

Argument params:

@param {Object} message
@param {String} channel
@param {Function} rpc this rpc callback handler will be added by this function
function (/*message, channel*/) {
        var args = Array.prototype.slice.apply(arguments);
        var message = args[0];

        var rpcCallbackHandler = function () {};

        

        // Check if event is of type "rpc".
        if ('__type' in message && message.__type === 'rpc') {
            // After the application executes the "done" handler,
            // the result will be trigger back to the "back channel" (rpc response).
            // After that step, the "rpc callback" handler will handle the result data.
            rpcCallbackHandler = function (err, result) {
                self.emit(
                    message.__backChannel,
                    {
                        err: err,
                        result: result
                    }
                );
            };
        }

        // Append our extended rpc callback handler
        args = [].concat(args, [rpcCallbackHandler]);

        // Call original handler with extended args
        handler.apply(null, args);
    }