-
Install protocol buffers compiler: https://grpc.io/docs/protoc-installation/
-
Install gRPC module (I assume Node is already installed in the system):
$ npm i grpc
$ npm i grpc-tools
- Dynamic implementation of gRPC and protocol buffers: https://grpc.io/docs/languages/node/basics/
NOTE: current project uses static implementation so some refactor must be done in the code to achive it.
Commmand to build the JavaScript files using the .proto file, remember to adjust paths and filenames of required:
protoc -I=. ./proto/chat2.proto --js_out=import_style=commonjs,binary:./server --grpc_out=./server
--plugin=protoc-gen-grpc=`which grpc_tools_node_protoc_plugin`
There is another option to do it using different compiler, remember to adjust paths and filenames of required:
$ ./gen-proto.sh
- First we remove package-lock.json to prevent conflicts:
rm package-lock.json
- Install modules:
npm install electron-rebuild
- Rebuild:
./node_modules/.bin/electron-rebuild
- Start the client (the server must be running/listening first)
npm start