Skip to content

Commit

Permalink
Use HTTP2MatchHeaderFieldSendSettings in example
Browse files Browse the repository at this point in the history
gRPC-Go has been waiting for the settings frame for a while now (soheilhy#64),
and having the old handler in the example is confusing users (soheilhy#67).
Use the new handler in the example and remove the "Limitations" from the README.
  • Loading branch information
johanbrandhorst authored Jan 10, 2022
1 parent 5ec6847 commit 2f676e4
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ m := cmux.New(l)

// Match connections in order:
// First grpc, then HTTP, and otherwise Go RPC/TCP.
grpcL := m.Match(cmux.HTTP2HeaderField("content-type", "application/grpc"))
// cmux.HTTP2MatchHeaderFieldSendSettings ensures we can handle any gRPC client.
grpcL := m.Match(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
httpL := m.Match(cmux.HTTP1Fast())
trpcL := m.Match(cmux.Any()) // Any means anything that is not yet matched.

Expand Down Expand Up @@ -68,13 +69,6 @@ when it's accepted. For example, one connection can be either gRPC or REST, but
not both. That is, we assume that a client connection is either used for gRPC
or REST.

* *Java gRPC Clients*: Java gRPC client blocks until it receives a SETTINGS
frame from the server. If you are using the Java client to connect to a cmux'ed
gRPC server please match with writers:
```go
grpcl := m.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
```

# Copyright and License
Copyright 2016 The CMux Authors. All rights reserved.

Expand Down

0 comments on commit 2f676e4

Please sign in to comment.