mirror of
https://github.com/geektutu/7days-golang.git
synced 2024-04-21 12:32:11 +00:00
Update geerpc-day1.md
This commit is contained in:
@@ -183,7 +183,7 @@ var DefaultOption = &Option{
|
||||
}
|
||||
```
|
||||
|
||||
一般来说,涉及协议协商的这部分信息,需要设计固定的字节来传输的。但是为了实现上更简单,GeeRPC 客户端固定采用 JSON 编码 Option,后续的 header 和 body 的编码方式由 Option 中的 CodeType 指定,服务端首先使用 JSON 解码 Option,然后通过 Option 得 CodeType 解码剩余的内容。即报文将以这样的形式发送:
|
||||
一般来说,涉及协议协商的这部分信息,需要设计固定的字节来传输的。但是为了实现上更简单,GeeRPC 客户端固定采用 JSON 编码 Option,后续的 header 和 body 的编码方式由 Option 中的 CodeType 指定,服务端首先使用 JSON 解码 Option,然后通过 Option 的 CodeType 解码剩余的内容。即报文将以这样的形式发送:
|
||||
|
||||
```bash
|
||||
| Option{MagicNumber: xxx, CodecType: xxx} | Header{ServiceMethod ...} | Body interface{} |
|
||||
@@ -439,4 +439,4 @@ reply: geerpc resp 4
|
||||
## 附 推荐阅读
|
||||
|
||||
- [Go 语言简明教程](https://geektutu.com/post/quick-golang.html)
|
||||
- [Go 语言笔试面试题](https://geektutu.com/post/qa-golang.html)
|
||||
- [Go 语言笔试面试题](https://geektutu.com/post/qa-golang.html)
|
||||
|
||||
Reference in New Issue
Block a user