z-docs/docs/tutorial-basics/broadcast.md
2024-09-22 09:55:13 +08:00

33 lines
669 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
sidebar_position: 2
title: 广播消息
description: 发送、接收广播消息
---
:::tip
消息接收
广播消息的消息接收,与主题消息、延时消息 api一致且使用了相同 topic 命名空间
- 消息接收
- 广播消息发送
:::
## 消息接收
> [广播消息接收](publish-subscribe.md#订阅主题消息)
## 广播消息发送
> 和发布订阅消息基本差不多
```java
private ZHubClient zhub;
@RestMapping(name = "publish_test", auth = false, comment = "发送广播消息测试")
public String publishTest(String value) {
zhub.broadcast("topic-a", value);
return "send ok!";
}
```