Skip to content

Commit df7f1c1

Browse files
authored
Merge pull request #21 from foxzool/new_websocket_example
new_websocket_example
2 parents c866ec5 + 11b37ec commit df7f1c1

38 files changed

+5003
-89
lines changed

.github/workflows/api-consistency-check.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ on:
1212
- 'src/service/**/*.rs'
1313
- 'src/core/**/*.rs'
1414

15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
issues: write
19+
1520
jobs:
1621
check-api-consistency:
1722
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- **WebSocket IM事件增强**: WebSocket客户端示例新增完整的IM事件监控功能
13+
- **✅ 消息撤回事件** - 支持 `p2_im_message_recalled_v1` 事件监听和处理
14+
- **✅ 群聊生命周期事件** - 支持群聊创建、更新、解散事件监听
15+
- `p2_im_chat_created_v1` - 群聊创建事件
16+
- `p2_im_chat_updated_v1` - 群聊更新事件
17+
- `p2_im_chat_disbanded_v1` - 群聊解散事件
18+
- **✅ 群成员管理事件** - 支持群成员变更事件监听
19+
- `p2_im_chat_member_user_added_v1` - 群成员添加事件
20+
- `p2_im_chat_member_user_deleted_v1` - 群成员移除事件
21+
- **🎯 增强用户体验** - 中文日志输出、性能计时、结构化错误处理
22+
- **📊 详细事件信息** - 显示事件ID、操作者、时间戳等完整上下文信息
23+
1224
- **Task v2**: 支持在 `CreateTaskRequest` 中指定 `tasklist_guid`,并新增 `TaskService::add_tasklist` 帮助方法,便于将既有任务加入指定清单。
1325
- **文档**: 更新任务模块文档,补充任务加入清单的示例和能力说明。
1426

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ path = "tools/api_compatibility_tester.rs"
192192
name = "client_setup"
193193
path = "examples/basic/client_setup.rs"
194194

195+
[[example]]
196+
name = "event_handler"
197+
path = "examples/basic/event_handler.rs"
198+
required-features = ["websocket", "im", "contact", "cloud-docs", "calendar", "vc", "approval"]
199+
195200
[[example]]
196201
name = "acs_example"
197202
path = "examples/api/acs_example.rs"

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ match result {
565565
### 长连接机器人
566566

567567
- [x] 接收事件推送
568+
- [x] 完整IM事件监控 (消息撤回、群聊管理、成员变更等)
568569

569570
### 云文档
570571

@@ -705,8 +706,12 @@ match result {
705706
- [x] 富文本
706707
- [x] 图片
707708
- [x] 卡片
708-
- 事件
709+
- 事件 (IM)
709710
- [x] 接收消息
711+
- [x] 消息已读
712+
- [x] 消息撤回
713+
- [x] 群聊创建/更新/解散
714+
- [x] 群成员添加/移除
710715

711716
### 群组
712717

@@ -885,7 +890,7 @@ match result {
885890
| **👥 通讯录** | 1 | ✅ 100% | 用户搜索 |
886891
| **🏢 组织架构** | 15 | ✅ 100% | **v0.12.0 新增** - 完整员工与部门管理 |
887892
| **🎨 飞书卡片** | 25 | ✅ 100% | 完整卡片组件系统 |
888-
| **💬 消息** | 4 | ✅ 100% | 消息发送与接收 |
893+
| **💬 消息** | 8 | ✅ 100% | 消息发送、接收与完整IM事件监控 |
889894
| **👥 群组** | 1 | ✅ 100% | 群组管理 |
890895
| **🔍 搜索** | 14 | ✅ 100% | 套件搜索与搜索连接器管理 |
891896
| **🏢 考勤管理** | 43 | ✅ 100% | 完整考勤解决方案 |

examples/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
### 🔰 [basic/](./basic/) - 基础入门 (2个)
119119
**最简单的入门示例,适合初学者**
120120
- `client_setup.rs` - 客户端基础配置
121-
- `websocket_client.rs` - WebSocket连接示例
121+
- `websocket_client.rs` - WebSocket连接与完整IM事件监控示例
122122

123123
### 📊 [benchmarks/](./benchmarks/) - 性能测试 (2个)
124124
**性能基准测试和监控示例**
@@ -167,8 +167,8 @@ cargo run --example client_setup
167167
如需运行其它服务示例,请显式启用对应 feature:
168168

169169
```bash
170-
# WebSocket 示例
171-
cargo run --example websocket_client --features websocket
170+
# WebSocket 示例 (包含完整IM事件监控)
171+
cargo run --example websocket_client --features websocket,im
172172

173173
# 招聘(hire)示例
174174
cargo run --example hire_v1_example --features hire

0 commit comments

Comments
 (0)