Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabrielgrant/grpc-bus-websocket-proxy-server
Provides a WebSocket Proxy Server for browsers to connect to any GRPC service
https://github.com/gabrielgrant/grpc-bus-websocket-proxy-server
Last synced: 5 days ago
JSON representation
Provides a WebSocket Proxy Server for browsers to connect to any GRPC service
- Host: GitHub
- URL: https://github.com/gabrielgrant/grpc-bus-websocket-proxy-server
- Owner: gabrielgrant
- Created: 2017-01-06T20:54:36.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-06-02T21:03:00.000Z (over 2 years ago)
- Last Synced: 2024-11-04T19:41:59.805Z (9 days ago)
- Language: JavaScript
- Homepage:
- Size: 89.8 KB
- Stars: 24
- Watchers: 3
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
GRPC-Bus WebSocket Proxy Server
This Node.js server acts as a proxy, connecting GRPC clients running in a browser context to standard GRPC service(s) via a WebSocket.
You'll want to use the [GRPC Bus WebSocket Proxy Client](http://github.com/gabrielgrant/grpc-bus-websocket-proxy-client) to connect from the browser.
Usage
```
node server.js
```How it Works
The browser client loads the Protobuf definition (either as a `.proto`
file or compiled as a `.proto.json`), and passes it to the server via
the initial message after creating the WebSocket connection.Deployment
There is a [Docker image built](https://hub.docker.com/r/gabrielgrant/grpc-bus-websocket-proxy/) that can be run with:
```
docker run gabrielgrant/grpc-bus-websocket-proxy
```It can also be deployed on a Kubernetes cluster using the included manifest:
```
kubectl create -f kubernetes-manifest.yaml
```If redeploying, delete the earlier deployment first:
```
kubectl delete -f kubernetes-manifest.yaml && kubectl create -f kubernetes-manifest.yaml
```TODO
- Upgrade to Protobuf JS v6
- Serve static content
- Allow server to load .proto file directly
- Push .proto file from server to client
- Validate service map against proto file
- Beter Error Handling
- Support bundled/synchronous loading of JSON-formatted protoDefs
- Specify allowed connections as CLI arg: --allow [service_name:]server:port
- Specify port as CLI arg: --port 8080Publishing a new version:
```
git checkout master
git pull
npm version patch
git push
VERSION=$(cat package.json| jq --raw-output .version)
docker build -t gabrielgrant/grpc-bus-websocket-proxy:latest -t gabrielgrant/grpc-bus-websocket-proxy:$VERSION .
docker push gabrielgrant/grpc-bus-websocket-proxy:$VERSION
docker push gabrielgrant/grpc-bus-websocket-proxy:latest
```