Skip to content

Commit

Permalink
Upgrade protobuf dependency to v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Apr 10, 2018
1 parent d203bd0 commit 0fa0da7
Show file tree
Hide file tree
Showing 31 changed files with 10,537 additions and 1,348 deletions.
19 changes: 5 additions & 14 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ required = [

[[constraint]]
name = "github.com/johanbrandhorst/protobuf"
version = "0.5.2"
version = "0.6.0"

[[constraint]]
branch = "master"
name = "github.com/improbable-eng/grpc-web"

[[constraint]]
branch = "master"
Expand Down
24 changes: 12 additions & 12 deletions frontend/bundle/bundle.go

Large diffs are not rendered by default.

16 changes: 2 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import (

"github.com/gorilla/websocket"
"github.com/improbable-eng/grpc-web/go/grpcweb"
"github.com/johanbrandhorst/protobuf/wsproxy"
"github.com/lpar/gzipped"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/grpclog"

"github.com/johanbrandhorst/grpcweb-boilerplate/backend"
Expand All @@ -42,23 +40,13 @@ func init() {
func main() {
gs := grpc.NewServer()
server.RegisterBackendServer(gs, &backend.Backend{})
wrappedServer := grpcweb.WrapServer(gs)

clientCreds, err := credentials.NewClientTLSFromFile("./cert.pem", "")
if err != nil {
logger.WithError(err).Fatal("Failed to get local server client credentials, did you run `make generate_cert`?")
}

wsproxy := wsproxy.WrapServer(
http.HandlerFunc(wrappedServer.ServeHTTP),
wsproxy.WithLogger(logger),
wsproxy.WithTransportCredentials(clientCreds))
wrappedServer := grpcweb.WrapServer(gs, grpcweb.WithWebsockets(true))

handler := func(resp http.ResponseWriter, req *http.Request) {
// Redirect gRPC and gRPC-Web requests to the gRPC-Web Websocket Proxy server
if req.ProtoMajor == 2 && strings.Contains(req.Header.Get("Content-Type"), "application/grpc") ||
websocket.IsWebSocketUpgrade(req) {
wsproxy.ServeHTTP(resp, req)
wrappedServer.ServeHTTP(resp, req)
} else {
// Serve the GopherJS client
folderReader(gzipped.FileServer(bundle.Assets)).ServeHTTP(resp, req)
Expand Down
2 changes: 1 addition & 1 deletion proto/client/web.pb.gopherjs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions vendor/github.com/gopherjs/websocket/LICENSE

This file was deleted.

176 changes: 0 additions & 176 deletions vendor/github.com/gopherjs/websocket/websocketjs/websocketjs.go

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion vendor/github.com/improbable-eng/grpc-web/go/grpcweb/options.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0fa0da7

Please sign in to comment.