diff options
| author | Semisol <45574030+Semisol@users.noreply.github.com> | 2024-04-14 07:32:41 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-14 07:32:41 +0300 |
| commit | 46f8133cd44bec99cd4611b8f52e54c46ade3648 (patch) | |
| tree | c775dd5c6c82a348b005b589018fa95ab1bab481 | |
| parent | b765b3c0301958d46115b834872bbd0c8bac588c (diff) | |
EOSE extensions draft
| -rw-r--r-- | 91.md | 53 |
1 files changed, 53 insertions, 0 deletions
| @@ -0,0 +1,53 @@ | |||
| 1 | NIP-91 | ||
| 2 | ====== | ||
| 3 | |||
| 4 | EOSE Extensions | ||
| 5 | --------------- | ||
| 6 | |||
| 7 | `draft` `optional` | ||
| 8 | |||
| 9 | This NIP defines an extension to the EOSE message that allows relays to convey additional information to clients. | ||
| 10 | |||
| 11 | ## Extended EOSE | ||
| 12 | |||
| 13 | An extended EOSE is an EOSE message, with the 2nd parameter being the "extensions object". For example: `["EOSE","example-sub",{"example_ext":"example value"}]` | ||
| 14 | |||
| 15 | An EOSE extension is a field in the extensions object. This may contain any value. | ||
| 16 | |||
| 17 | Experimental extensions SHOULD use the `x_` prefix for the object key. | ||
| 18 | |||
| 19 | Clients MUST NOT rely on relays implementing any extensions. | ||
| 20 | |||
| 21 | ## Extensions | ||
| 22 | |||
| 23 | This NIP defines a set of standard extensions. | ||
| 24 | |||
| 25 | ### `next_created_at` | ||
| 26 | `recommended` | ||
| 27 | |||
| 28 | The value of this extension MUST be an integer if present, and should specify the next `until` value the client should use for pagination. | ||
| 29 | This MAY be higher or lower than the lowest `created_at`, and the clients SHOULD NOT perform any modifications to this value. | ||
| 30 | |||
| 31 | ### `cursor` | ||
| 32 | |||
| 33 | The value of this extension MUST be a string if present, and represents a cursor the client can use to paginate this query. | ||
| 34 | To get more events, the client MUST send a `REQ` with the same filters (except limit, which can be changed), and the `cursor` string | ||
| 35 | in the 1st filter with the key `cursor`. Example: | ||
| 36 | ```jsonc | ||
| 37 | < ["REQ", "examplereq1", {"kinds": [1], "limit": 1}, {"authors": ["..."], "limit": 1}] | ||
| 38 | > ["EVENT", "examplereq1", ...] | ||
| 39 | > ["EOSE", "examplereq1", {"cursor": "example-cursor-string", ...}] | ||
| 40 | < ["CLOSE", "examplereq1"] | ||
| 41 | < ["REQ", "examplereq2", {"kinds": [1], "limit": 5, "cursor": "example-cursor-string"}, {"authors": ["..."], "limit": 5}] | ||
| 42 | > ["EVENT", "examplereq2", ...] | ||
| 43 | ... | ||
| 44 | ``` | ||
| 45 | |||
| 46 | This cursor MUST be valid for the duration of the connection, and MAY be valid in a new connection. A relay may indicate a cursor is no longer valid | ||
| 47 | by sending a CLOSED with the prefix `bad-cursor: `. | ||
| 48 | |||
| 49 | ### `has_more` | ||
| 50 | `recommended` | ||
| 51 | |||
| 52 | The value of this extension MUST be a boolean if present, and should represent if the client should continue trying to get events. | ||
| 53 | This MAY be false if the relay has completed the query due to not having more events available, or may not be able to complete this query due to a permanent failure (scan limit exceeded is one). | ||