Skip to content

WhisperN/gRPC-Web-Frontend

Repository files navigation

gRPC performance frontend

I took quite some substancial inspiration from this REPO.

Setup

npm install arrow-js-ffi

Protocol Buffer

Compiling from source
Unfortunately we cannot compile .protoc files to js with the original protoc command from google. Thats why we use the official protobuf-javascript library.

Prerequisites

  • npm
  • (bazel) -> If you want to play around with yourself compiling

Installation

npm install -g grpc-tools
npm install -g protoc-gen-grpc-web

Compile the Protobuf file
Run this from the /proto directory of the Project

grpc_tools_node_protoc \
   --js_out=import_style=commonjs:. \
   --grpc-web_out=import_style=commonjs,mode=grpcwebtext:. \
   Flight.proto

Optional: If you hate yourself then use the flag closure instead of commonjs
If you want modern and with TS

grpc_tools_node_protoc \
    --js_out=import_style=es6:. \
    --grpc-web_out=import_style=es6,mode=grpcwebtext:. \
    Flight.proto

This generates the Flight_grpc_web client file and the regular protobuf to js compilation.
Done.

WebAssembly notes

# Compile the wasm code
cd wasm/go
GOOS=js GOARCH=wasm go build -o main.wasm
rm ../../public/main.wasm
mv main.wasm ../../public

Then serve....

1. Optimization using TinyGo

Not in use in this project

# macos 
brew tap tinygo-org/tools
brew install tinygo

compile our wasm code:

GOOS=js GOARCH=wasm tinygo build -o wasm.wasm ./main.go
# Or like so:
tinygo build -o public/main.wasm -target wasm -opt z .

Start

npm build
npm start

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published