2
0
mirror of https://github.com/soheilhy/cmux.git synced 2024-11-10 03:31:52 +08:00

Update README.md

gRPC-Go has been waiting for the settings frame for a while now (https://github.com/soheilhy/cmux/issues/64),
and having the old handler in the example is confusing users (https://github.com/soheilhy/cmux/issues/67).
Use the new handler in the example and remove the "Limitations" from the README.
This commit is contained in:
Johan Brandhorst-Satzkorn 2022-01-10 16:26:07 -05:00 committed by GitHub
parent 5ec6847320
commit e885ea5a5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,8 @@ m := cmux.New(l)
// Match connections in order: // Match connections in order:
// First grpc, then HTTP, and otherwise Go RPC/TCP. // 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.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
httpL := m.Match(cmux.HTTP1Fast()) httpL := m.Match(cmux.HTTP1Fast())
trpcL := m.Match(cmux.Any()) // Any means anything that is not yet matched. trpcL := m.Match(cmux.Any()) // Any means anything that is not yet matched.
@ -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 not both. That is, we assume that a client connection is either used for gRPC
or REST. 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 and License
Copyright 2016 The CMux Authors. All rights reserved. Copyright 2016 The CMux Authors. All rights reserved.