Clarify HPUB and HMSG examples (#1695)

This commit is contained in:
Scott Fauerbach
2020-11-11 14:12:44 -05:00
committed by GitHub
parent 84591c1e16
commit 9b13150b83

View File

@@ -57,16 +57,16 @@ Messages that include a header have a `HPUB` protocol:
```
HPUB SUBJECT REPLY 23 30␍␊NATS/1.0␍␊Header: X␍␊␍␊PAYLOAD␍␊
HPUB SUBJECT REPLY 23 23␍␊NATS/1.0␍␊Header: X␍␊␍␊␍␊
HPUB SUBJECT REPLY 48 55␍␊NATS/1.0␍␊Header1: X␍␊Header1: Y␍␊Header2: Z␍␊␍␊PAYLOAD␍␊
HPUB SUBJECT REPLY 48 48␍␊NATS/1.0␍␊Header1: X␍␊Header1: Y␍␊Header2: Z␍␊␍␊␍␊
HPUB <SUBJ> [REPLY] <HDR_LEN> <TOT_LEN>
<HEADER><PAYLOAD>
```
#### NOTES:
- `HDR_LEN` includes the entire serialized header
- `TOT_LEN` includes the entire payload length including the header
- `HDR_LEN` includes the entire serialized header, from the start of the version string up to and including the ␍␊ before the payload
- `TOT_LEN` the payload length plus the HDR_LEN
### MSG with Headers
@@ -74,15 +74,16 @@ Clients will see `HMSG` protocol lines for `MSG`s that contain headers
```
HMSG SUBJECT 1 REPLY 23 30␍␊NATS/1.0␍␊Header: X␍␊␍␊PAYLOAD␍␊
HPUB SUBJECT 1 REPLY 23 23␍␊NATS/1.0␍␊Header: X␍␊␍␊␍␊
HMSG SUBJECT 1 REPLY 23 23␍␊NATS/1.0␍␊Header: X␍␊␍␊␍␊
HMSG SUBJECT 1 REPLY 48 55␍␊NATS/1.0␍␊Header1: X␍␊Header1: Y␍␊Header2: Z␍␊␍␊PAYLOAD␍␊
HMSG SUBJECT 1 REPLY 48 48␍␊NATS/1.0␍␊Header1: X␍␊Header1: Y␍␊Header2: Z␍␊␍␊␍␊
HMSG <SUBJECT> <SID> [REPLY] <HDR_LEN> <TOT_LEN>
<PAYLOAD>
```
- `HDR_LEN` includes the entire header
- `TOT_LEN` includes the entire payload length including the header
- `HDR_LEN` includes the entire serialized header, from the start of the version string up to and including the ␍␊ before the payload
- `TOT_LEN` the payload length plus the HDR_LEN
## Decision