gopherjs-grpc-websocket

command module
v0.0.0-...-d45a67e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2017 License: MIT Imports: 20 Imported by: 0

README

gopherjs-grpc-websocket

An example implementation of bridging a gRPC backend with a GopherJS frontend over Websockets, XHR requests and the grpc-gateway.

A large focus of this project is to show that you can implement both simple HTTP requests and complex bi-directional websocket streaming without compromising generated file size. The generated js for this example weighs in at 942KB.

This takes inspiration from projects like https://github.com/philips/grpc-gateway-example.

Generate the proto files

This requires installing the go programs from the vendor folder and protoc. It also assumes you have python3 in your $PATH.

Download the latest protoc from github.com

Install go dependencies:

$ go install ./vendor/...

Generate!

$ ./generate.py

Generate the client

Install gopherjs (note that gopherjs cannot be vendored, see https://github.com/gopherjs/gopherjs/issues/415):

$ go get -u github.com/gopherjs/gopherjs/js

Generate!

$ go generate ./client/

This creates a go-bindata-compiled file which can easily be served from the server.

Running the server

$ go run main.go

Navigate to localhost and check it out!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
protos
server
Package server is a generated protocol buffer package.
Package server is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL