Skip to content

Commit

Permalink
docs: fix a problem of transport protocol doc(kitex) (#1043)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhu-mi-shan authored Mar 19, 2024
1 parent 35b0413 commit ee73960
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var opts []client.Option
opts = append(opts, client.WithTransportProtocol(transport.TTHeader))
opts = append(opts, client.WithMetaHandler(transmeta.ClientTTHeaderHandler))

cli := xxx.NewClient("service_name", opts)
cli := xxx.NewClient("service_name", opts...)
```

4. configure TTHeaderFramed: TTHeader | Framed (Bit OR)
Expand All @@ -57,7 +57,7 @@ cli := xxx.NewClient("service_name", opts)
var opts []client.Option
opts = append(opts, client.WithTransportProtocol(transport.TTHeaderFramed))
opts = append(opts, client.WithMetaHandler(transmeta.ClientTTHeaderHandler))
cli := xxx.NewClient("service_name", opts)
cli := xxx.NewClient("service_name", opts...)
```

#### gRPC
Expand All @@ -68,7 +68,7 @@ client configures gRPC protocol:
var opts []client.Option
opts = append(opts, client.WithTransportProtocol(transport.GRPC))
opts = append(opts, client.WithMetaHandler(transmeta.ClientHTTP2Handler))
cli := xxx.NewClient("service_name", client.WithTransportProtocol(transport.GRPC))
cli := xxx.NewClient("service_name", opts...)
```

NOTE: if there's no streaming API in the IDL, this option is needed for enabling gRPC protocol, otherwise kitex will only send protobuf binary (not gRPC).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var opts []client.Option
opts = append(opts, client.WithTransportProtocol(transport.TTHeader))
opts = append(opts, client.WithMetaHandler(transmeta.ClientTTHeaderHandler))

cli := xxx.NewClient("service_name", opts)
cli := xxx.NewClient("service_name", opts...)
```

4. 指定 TTHeaderFramed:TTHeader | Framed (Bit OR)
Expand All @@ -56,7 +56,7 @@ cli := xxx.NewClient("service_name", opts)
var opts []client.Option
opts = append(opts, client.WithTransportProtocol(transport.TTHeaderFramed))
opts = append(opts, client.WithMetaHandler(transmeta.ClientTTHeaderHandler))
cli := xxx.NewClient("service_name", opts)
cli := xxx.NewClient("service_name", opts...)
```

#### gRPC
Expand All @@ -67,7 +67,7 @@ client 指定 gRPC 协议:
var opts []client.Option
opts = append(opts, client.WithTransportProtocol(transport.GRPC))
opts = append(opts, client.WithMetaHandler(transmeta.ClientHTTP2Handler))
cli := xxx.NewClient("service_name", client.WithTransportProtocol(transport.GRPC))
cli := xxx.NewClient("service_name", opts...)
```

注意: 如果 IDL 中没有 Streaming API,则需要此选项来启用 gRPC 协议,否则 kitex 将仅发送 protobuf binary(而不是 gRPC)。
Expand Down

0 comments on commit ee73960

Please sign in to comment.