code: function send(request) {
      var method = request.method
      var params = request.params
      var callback = request.callback
      var stack = request.stack
  
      var requestTimestamp = Date.now()
  
      rpc.encode(method, params, function (error, result) {
        if (error) {
          var responseTimestamp = Date.now()
  
          var constructor = Error
          switch (error.code) {
          case MEDIA_OBJECT_TYPE_NOT_FOUND:
            constructor = TypeError
            break
  
          case MEDIA_OBJECT_NOT_FOUND:
            constructor = ReferenceError
            break
  
          case MEDIA_OBJECT_METHOD_NOT_FOUND:
            constructor = SyntaxError
            break
          }
  
          error = extend(new constructor(error.message || error), error);
  
          Object.defineProperties(error, {
            'requestTimestamp': {
              value: requestTimestamp
            },
            'responseTimestamp': {
              value: responseTimestamp
            },
            'stack': {
              value: [error.toString()].concat(
                error.stack.split('\n')[1],
                error.stack.split('\n').slice(2)
              ).join('\n')
            }
          })
        } else if ((self.sessionId !== result.sessionId) && (result.value !==
            'pong'))
          Object.defineProperty(self, 'sessionId', {
            configurable: true,
            value: result.sessionId
          })
  
        callback(error, result);
      });
    }
docs: Encode commands