Skip to content

Commit cb4a92a

Browse files
author
Felix021
authored
doc: update framed desc for frugal (#816)
1 parent 20a7f2e commit cb4a92a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

content/en/docs/kitex/Tutorials/advanced-feature/codec_frugal.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,11 @@ For enabling Framed: prepend a 4-byte (int32) length to indicate the size of thr
173173
client.WithTransportProtocol(transport.Framed)
174174
```
175175
Note:
176-
1. It's not necessary, but without it, the server side may not be able to decode with frugal (refer to: "Kitex Server -> Notes");
176+
1. If Framed is not set, there may be issues:
177+
1. The server may not be able to decode with frugal without Payload Size (refer to: "Kitex Server -> Notes");
178+
2. The server won't reply with a `Framed` payload, thus the Client may also not be able to decode with frugal (no Payload Size again);
177179
2. If the target server does not support `Framed`, then don't use it; the client can encode without it, but if the response (from the server) is not Framed (i.e. with preprended payload size), the client may not be able to decode with Frugal (so in this case, do not use slim template);
178-
3. `TTHeaderFramed` is an alternative.
180+
3. `TTHeaderFramed` is an alternative (it's the BIT-OR result of `TTHeader | Framed`).
179181

180182
##### Example Code
181183

content/zh/docs/kitex/Tutorials/advanced-feature/codec_frugal.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ client.WithTransportProtocol(transport.Framed)
177177
```
178178

179179
注:
180-
1. 非必须;如不指定 Framed,Server 端可能无法用 frugal 解码(详见 "Kitex Server -> 注意事项");
180+
1. 如不指定 Framed,可能存在如下问题:
181+
1. Server 端可能无法用 frugal 解码(因为读不到 Payload Size,详见 "Kitex Server -> 注意事项");
182+
2. Server 端不会返回 Framed Payload,Client 可能无法用 frugal 解码(因为读不到 Payload Size);
181183
2. 如果目标 Server 不支持 Framed,则不应指定。不影响 Client 侧使用 frugal 编码;但 Server 回包如不是 Framed,Client 可能无法用 frugal 解码(这种情况慎用 slim 模板);
182-
3. 也可使用 TTHeaderFramed。
184+
3. 也可使用 TTHeaderFramed(即 `TTHeader | Framed` 位与结果)
183185

184186
##### 示例代码
185187

0 commit comments

Comments
 (0)