# NIP16

## 事件处理

`draft` `optional` `author:Semisol`

继电器可决定允许可更换和/或短暂事件。

## 定期活动

A*定期活动*被定义为具有种类 `1000 <= n < 10000` 的事件。在接收到常规事件时，中继应将其发送到具有匹配过滤器的所有客户端，并应存储它。新的同类事件不会以任何方式影响以前的事件。

## 可替换事件

A*可替换事件*被定义为具有种类 `10000 <= n < 20000` 的事件。当接收到具有比当前已知的具有相同类型的最新可替换事件更新的时间戳的可替换事件，并由相同的密钥签名时，应当丢弃旧事件并用较新的事件替换。

## 短暂的事件

将*短暂的事件*定义为具有种类 `20000 <= n < 30000` 的事件。在接收到临时事件时，中继应将其发送给具有匹配过滤器的所有客户端，并且不得存储它。

## 客户行为

客户端应使用该 `supported_nips` 字段来了解中继是否支持此 NIP.客户端不应向不支持此 NIP 的中继发送临时事件。它们很可能会持续存在。客户端可能会将可替换的事件发送到可能不支持此 NIP 的中继，并且查询的客户端应为中继发送多个事件做好准备，并应使用最新的事件。

## 建议的使用情形

* 状态：应用程序可以创建一个状态事件，每次设置新状态（如状态）时都会替换该状态事件。
* 打字指示器：聊天应用程序可以使用短暂事件作为打字指示器。
* 消息传递：两个公钥可以使用临时事件通过 NOSTR 发送消息。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sherry-pang.gitbook.io/nostr-cn/fu-lu-1-nip-xiang-jie/16.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
