Improving the d-Tag needs and prefixes in messages.

This commit is contained in:
Vitor Pamplona 2024-01-03 14:21:16 -05:00
parent f69e5b241c
commit e1b9ffdd09

8
01.md
View File

@ -79,6 +79,8 @@ Specific ranges define storage behaviors:
| Ephemeral | `20000 <= kind < 30000` | Nothing | | Ephemeral | `20000 <= kind < 30000` | Nothing |
| Parameterized | `30000 <= kind < 40000` | The newest event for each `pubkey`, `kind` and `d`-tag | | Parameterized | `30000 <= kind < 40000` | The newest event for each `pubkey`, `kind` and `d`-tag |
Parameterized Repleaceable events MUST include a `d`-tag with an identifier value to be used as reference.
In case of replaceable events with the same timestamp, the event with the lowest `.id` (first in lexical order) SHOULD be retained. Older versions MAY be kept but SHOULD not be returned on queries. In case of replaceable events with the same timestamp, the event with the lowest `.id` (first in lexical order) SHOULD be retained. Older versions MAY be kept but SHOULD not be returned on queries.
This NIP defines two kinds: This NIP defines two kinds:
@ -162,7 +164,7 @@ Relays send 3 types of messages during a subscription:
* `["EVENT", <subscription_id>, <JSON-serialized string of the event>]`, used to send events requested by clients. * `["EVENT", <subscription_id>, <JSON-serialized string of the event>]`, used to send events requested by clients.
* `["EOSE", <subscription_id>]`, used to indicate the _end of stored events_ and the beginning of events newly received in real-time. * `["EOSE", <subscription_id>]`, used to indicate the _end of stored events_ and the beginning of events newly received in real-time.
* `["CLOSED", <subscription_id>, <message>]`, used to indicate that a subscription was ended on the server side. * `["CLOSED", <subscription_id>, <prefix>:<message>]`, used to indicate that a subscription was ended on the server side.
All messages MUST be sent with the `subscription_id` initiated by the client (using the `REQ` message above). All messages MUST be sent with the `subscription_id` initiated by the client (using the `REQ` message above).
@ -176,7 +178,7 @@ To send an event to the Relay, Clients send a broadcast message in the format:
Relays reply with an ACK message in the format of: Relays reply with an ACK message in the format of:
* `["OK", <event_id>, <accepted:true|false>, <message>]`, used to indicate acceptance (true) or denial (false) of an `EVENT`. * `["OK", <event_id>, <accepted>, <prefix>:<message>]`, used to indicate acceptance (true) or denial (false) of an `EVENT`.
`OK` messages MUST be sent in response to `EVENT` messages received from clients, they must have the 3rd parameter set to `true` when an event has been accepted by the relay, `false` otherwise. The 4th parameter MUST always be present, but MAY be an empty string when the 3rd is `true`. `OK` messages MUST be sent in response to `EVENT` messages received from clients, they must have the 3rd parameter set to `true` when an event has been accepted by the relay, `false` otherwise. The 4th parameter MUST always be present, but MAY be an empty string when the 3rd is `true`.
@ -188,7 +190,7 @@ Notices are warnings that might help explain or debug the behavior of a given re
* `["NOTICE", <message>]`, used to send human-readable error messages or other things to clients. * `["NOTICE", <message>]`, used to send human-readable error messages or other things to clients.
## Error Codes ## Message Prefixes
The standardized machine-readable prefixes for `OK` and `CLOSED` are: `duplicate`, `pow`, `blocked`, `rate-limited`, `invalid`, and `error` for when none of that fits. The standardized machine-readable prefixes for `OK` and `CLOSED` are: `duplicate`, `pow`, `blocked`, `rate-limited`, `invalid`, and `error` for when none of that fits.