Open dhuseby opened 11 months ago
I would make a PR right now to fix the problems but the spec, as it is, can be interpreted different ways and I don't want to dump raw messages to figure out the behavior in the wild. Once I confirm the actual wire protocol, I can submit a PR to clean this up.
When using the TCP transport, the first multistream exchange happens in the clear, so it should be easy to inspect using Wireshark.
Reading the spec I noticed that the code blocks in the beginning show a pseudo-wire protocol representation by just showing the contents of each message without explicitly showing the varint message length and the newline suffix. For instance this example is like that:
https://github.com/multiformats/multistream-select/blob/77f0b4449e9daea8bfefc3ffcb07084175f4c6d7/README.md?plain=1#L45-L48
Only later, in an easy-to-miss note do we point out the critical details that every message has a varint length and newline suffix:
https://github.com/multiformats/multistream-select/blob/77f0b4449e9daea8bfefc3ffcb07084175f4c6d7/README.md?plain=1#L82
Farther down in the spec, the examples begin to show the varint length explicitly:
https://github.com/multiformats/multistream-select/blob/77f0b4449e9daea8bfefc3ffcb07084175f4c6d7/README.md?plain=1#L182-L188
Suggestions for improvement: