Autodetect ProtoBuf.js version in grpc.loadObject
diff --git a/src/node/index.js b/src/node/index.js
index 43a4a54..e41664e 100644
--- a/src/node/index.js
+++ b/src/node/index.js
@@ -58,12 +58,17 @@
 grpc.setDefaultRootsPem(fs.readFileSync(SSL_ROOTS_PATH, 'ascii'));
 
 exports.loadObject = function loadObject(value, options) {
-  options = _.defaults(options, {'protobufjs_version': 5});
-  switch (options.protobufjs_version) {
-    case 5: return protobuf_js_5_common.loadObject(value, options);
-    case 6: return protobuf_js_6_common.loadObject(value, options);
-    default: throw new Error('Unrecognized protobufjs_version:',
-                             options.protobufjs_version);
+  options = _.defaults(options, common.defaultGrpcOptions);
+  if (value instanceof ProtoBuf.ReflectionObject) {
+    return protobuf_js_6_common.loadObject(value, options);
+  } else {
+    /* If value is not a ProtoBuf.js 6 reflection object, we assume that it is
+       a ProtoBuf.js 5 reflection object, for backwards compatibility */
+    var deprecation_message = 'Calling grpc.loadObject with an object ' +
+        'generated by ProtoBuf.js 5 is deprecated. Please upgrade to ' +
+        'ProtoBuf.js 6.';
+    common.log(grpc.logVerbosity.INFO, deprecation_message);
+    return protobuf_js_5_common.loadObject(value, options);
   }
 };
 
@@ -108,7 +113,6 @@
      still the possibility of adding other formats that would be loaded
      differently */
   options = _.defaults(options, common.defaultGrpcOptions);
-  options.protobufjs_version = 6;
   var root = new ProtoBuf.Root();
   var parse_options = {keepCase: !options.convertFieldsToCamelCase};
   return loadObject(root.loadSync(applyProtoRoot(filename, root),