prtbuf-j0h7g6ftgyh

0.0.925 • Public • Published

protobuf

Getting started

Protocol Buffers are a language-neutral, platform-neutral extensible mechanism for serializing structured data.
Each service has own protocol for send/consume data.
Each service has own directory with 3 simple file:

  • SERVICE_NAME_grpc_pb.js [server]
  • SERVICE_NAME_pb.js [client]
  • SERVICE_NAME.proto [protocol]

##Install You should need GRPC tools installed globally in NPM, so npm install -g grpc-tools

##Extending

  • Define a service in a .proto file.
  • Add new rpc service commands with requests/responses with messages which describe input/output data Example of simple proto auth service with single rpc command checkConnection:
   
   package auth;
   
   service Auth {
       rpc checkConnection(PingRequest) returns (PongResponse);
   }
   
   message PingRequest {
       string ping = 1;
   }
   
   message PongResponse {
       string pong = 1;
   }
  • Run command: grpc_tools_node_protoc --js_out=import_style=commonjs,binary:SERVICE_NAME --grpc_out=grpc_js:SERVICE_NAME --proto_path=./SERVICE_NAME ./SERVICE_NAME/*.proto

If you want to process multiple *.proto files at once, run the sh update_prtbuf_version.sh script found in the root directory. This script will simultaneously update the protobuf version in package.json and rebuild all grpc_pb / pb files.

Package Sidebar

Install

npm i prtbuf-j0h7g6ftgyh

Weekly Downloads

1,440

Version

0.0.925

License

SEE LICENSE IN LICENSE.txt

Unpacked Size

8.12 MB

Total Files

37

Last publish

Collaborators

  • azbukin.oleksii.swq