Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add recommendation for consolidating packets #20

Merged
merged 1 commit into from
Mar 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,42 @@ For example
< ...
```

#### Implementation Recommendations

**Protocol Selection**

When selecting a protocol, the initiator SHOULD send the multistream protocol AND the desired protocol in the same packet. Similarly, the responder SHOULD send its first response in the same packet as the multistream protocol.

For example:

```sh
# successful negotiation of the kad protocol
> /multistream/1.0.0\n/ipfs/kad/1.0.0\n
< /multistream/1.0.0\n/ipfs/kad/1.0.0\n
```

```sh
# successful negotiation of the kad protocol, with missing version support
> /multistream/1.0.0\n/ipfs/kad/1.0.0\n
< /multistream/1.0.0\nna\n
> /ipfs/kad/0.2.3\n
< /ipfs/kad/0.2.3\n
```

**Listing**

When requesting a list of protocols, if the multistream protocol has not yet been negotiated, the initiator SHOULD send the `ls` request in the same packet as the multistream protocol. Similarly, the responder SHOULD send its list of supported protocols in the same packet as the multistream protocol.

For example:

```sh
# request the list of protocols
> /multistream/1.0.0\nls\n

# response with supported protocols
< /multistream/1.0.0\n/ipfs/kad/0.2.3\n/ipfs/kad/1.0.0\n/ipfs/bitswap/0.4.3\n/ipfs/bitswap/1.0.0\n
```

### ls example in detail

```
Expand Down