How to use the grpc.loadObject function in grpc

To help you get started, we’ve selected a few grpc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GroaJS / groa / lib / loader.js View on Github external
const loadProto = async function(filename) {

	const root = await prepareRoot();

	// Loading file
	let parsedObj = await ProtoBuf.load(filename, root);
	let def = grpc.loadObject(parsedObj);

	return {
		root: root,
		services: listServices('', def)
	};
};
github Azure / azure-functions-nodejs-worker / src / GrpcService.ts View on Github external
function GetGrpcClientConstructor(): GrpcClientConstructor {
    let reflectionObject = protobuf.Root.fromJSON(jsonModule as protobuf.INamespace);
    let rpcs = grpc.loadObject(reflectionObject, { enumsAsStrings: false, protobufjsVersion: 6 });
    return rpcs.AzureFunctionsRpcMessages["FunctionRpc"];
}
github paralin / grpc-bus / src / server / server.spec.ts View on Github external
beforeEach(() => {
    lookupTree = buildTree();
    server = new Server(lookupTree, (msg: IGBServerMessage) => {
      recvQueue.push(msg);
    }, require('grpc'));
    recvQueue.length = 0;
    let serviceTree = require('grpc').loadObject(lookupTree).build();
    encodedData = serviceTree.mock.HelloRequest.encode({'name': 'hello'}).toBase64();
    encodedResponseData = serviceTree.mock.HelloReply.encode({message: 'hello'}).toBase64();
  });
github nathangoulding / grpcli / lib / index.js View on Github external
var grpcLoad = function(filename, format, options) {
	const ProtoBuf = require('protobufjs');

	var builder = ProtoBuf.loadProtoFile(filename);

	if (!builder) {
		throw new Error('Could not load file "' + filename + '"');
	}

	return grpc.loadObject(builder.ns, {});
}
github GroaJS / groa / lib / loader.js View on Github external
const parseProto = async function(proto) {

	const root = await prepareRoot();

	let parserResult = ProtoBuf.parse(proto, root);
	let def = grpc.loadObject(parserResult.root);

	return {
		root: root,
		services: listServices('', def)
	};
};
github hyperledger / fabric-sdk-node / fabric-client / lib / ProtoLoader.js View on Github external
static load(filename) {
		const builder = protobuf.loadProtoFile(filename);
		return grpc.loadObject(builder, {protobufjsVersion: 5});
	}