> For the complete documentation index, see [llms.txt](https://ceramic-zhong-wen-wen-dang.gitbook.io/ceramic-zhong-wen-wen-dang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ceramic-zhong-wen-wen-dang.gitbook.io/ceramic-zhong-wen-wen-dang/ceramic-xie-yi/wang-luo/tip-chuan-bo.md).

# TIP 传播

当流更新时，最新的事件（tip）会被传播到对该特定流感兴趣的网络中的所有节点。此外，监听所有提示可以使节点了解它之前不知道的流。这使得网络中所有感兴趣的节点都能快速获取流的最新更新和状态。

## **协议**

&#x20; **发布更新**  当创建事件并将其附加到流中时，节点将向网络发布更新消息。所有消息都会在此节点配置的[网络](https://developers.ceramic.network/protocol/networking/networks/)上的[libp2p pubsub](https://github.com/libp2p/specs/tree/master/pubsub)主题上广播。任何其他监听此网络的节点都将接收更新，然后可以自行决定采取进一步行动或丢弃。  **更新消息**

```JSON
type UpdateMessage = {
  typ: MsgType.UPDATE //0
  stream: StreamID
  tip: CID
  model?: StreamID
}
```

&#x20; 其中：

* typ - 消息是更新消息，枚举值为 1
* stream -此更新所涉及的流ID
* Tip - 流的最新更新事件（TIP）的CID
* Model - 被更新的流所属ComposeDB数据模型的streamId（可选）

**复制更新**任何已接收更新消息并对该流感兴趣的节点现在都可以保存最新信息（更新）。任何已保存此更新的节点现在都可以回答有关此流的查询。只要网络中至少有一个节点保存了这些信息（提示），发布节点就可以关闭而不影响流的可用性。\
例子TypeScript 定义

```JSON
/**
 * Ceramic Pub/Sub message type.
 */
enum MsgType {
  UPDATE = 0,
  QUERY = 1,
  RESPONSE = 2,
  KEEPALIVE = 3,
}

type UpdateMessage = {
  typ: MsgType.UPDATE
  stream: StreamID
  tip: CID  // the CID of the latest commit
  model?: StreamID // optional
}

// All nodes will always ignore this message
type KeepaliveMessage = {
  typ: MsgType.KEEPALIVE
  ts: number // current time in milliseconds since epoch
  ver: string // current ceramic version
}
```

####
