mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-15 11:56:22 +00:00
fe9ed69dc3
- This is so that relays can converge on a deterministic sets of events, no matter the order they were received - Otherwise, clients or relays that sync their sets of events could continually retransmit events they think are missing on the other side, wasting bandwidth
41 lines
1.9 KiB
Markdown
41 lines
1.9 KiB
Markdown
NIP-16
|
|
======
|
|
|
|
Event Treatment
|
|
---------------
|
|
|
|
`draft` `optional` `author:Semisol`
|
|
|
|
Relays may decide to allow replaceable and/or ephemeral events.
|
|
|
|
Regular Events
|
|
------------------
|
|
A *regular event* is defined as an event with a kind `1000 <= n < 10000`.
|
|
Upon a regular event being received, the relay SHOULD send it to all clients with a matching filter, and SHOULD store it. New events of the same kind do not affect previous events in any way.
|
|
|
|
Replaceable Events
|
|
------------------
|
|
A *replaceable event* is defined as an event with a kind `10000 <= n < 20000`.
|
|
Upon a replaceable event with a newer timestamp than the currently known latest replaceable event with the same kind and author being received, the old event SHOULD be discarded,
|
|
effectively replacing what gets returned when querying for
|
|
`author:kind` tuples.
|
|
|
|
If two events have the same timestamp, the event with the lowest id (first in lexical order) SHOULD be retained, and the other discarded.
|
|
|
|
Ephemeral Events
|
|
----------------
|
|
An *ephemeral event* is defined as an event with a kind `20000 <= n < 30000`.
|
|
Upon an ephemeral event being received, the relay SHOULD send it to all clients with a matching filter, and MUST NOT store it.
|
|
|
|
Client Behavior
|
|
---------------
|
|
|
|
Clients SHOULD use the `supported_nips` field to learn if a relay supports this NIP. Clients SHOULD NOT send ephemeral events to relays that do not support this NIP; they will most likely be persisted. Clients MAY send replaceable events to relays that may not support this NIP, and clients querying SHOULD be prepared for the relay to send multiple events and should use the latest one.
|
|
|
|
Suggested Use Cases
|
|
-------------------
|
|
|
|
* States: An application may create a state event that is replaced every time a new state is set (such as statuses)
|
|
* Typing indicators: A chat application may use ephemeral events as a typing indicator.
|
|
* Messaging: Two pubkeys can message over nostr using ephemeral events.
|