feat(phase2e-2): WebSocket 信令协议 13 事件全量落地(Task 6)
将 meeting.* 事件族从 Task 5 的 PublishToUser 循环升级为完整 WS 信令协议:
抽离统一广播层、扩容 MediaOrchestrator 接口、实现 8 个 C→S 事件业务逻辑
+ Redis 资源追踪 + host 权限校验,端到端 18/18 PASS。
核心产出:
- 新建 MeetingBroadcaster(统一广播层,REST/WS 共用)
- 新建 MeetingSignalService 8 C→S 事件 + cleanupUserResources
- 新建 MeetingWSHandler 薄层 controller
- MediaOrchestrator 扩容 9 方法 + NoopMediaOrchestrator 占位(Task 7 替换)
- C→S 白名单机制防恶意伪造广播事件
- Redis Set 资源追踪防 mediasoup 端资源泄漏
文档同步:
- docs/api/frontend/meeting.md 追加 §WebSocket 信令协议(Task 6)200 行
- docs/progress/CURRENT_STATUS.md + project-context.mdc + 实施计划 Task 6 ✅
Made-with: Cursor
This commit is contained in:
@@ -54,8 +54,10 @@ type App struct {
|
||||
NotifyService *notifyService.NotifyService // 通知业务服务(兼 Pusher、ConnectHook)
|
||||
NotifyController *notifyController.NotificationController // 通知控制器
|
||||
NotifyCleanupTask *notifyTask.CleanupTask // 通知清理定时任务
|
||||
MeetingService *meetingService.MeetingService // 会议业务服务(Task 4 骨架)
|
||||
MeetingController *meetingController.MeetingController // 会议控制器(Task 4 骨架,handler 返回 501)
|
||||
MeetingService *meetingService.MeetingService // 会议 REST 业务服务(Task 5 落地)
|
||||
MeetingSignalService *meetingService.MeetingSignalService // 会议 WS 信令业务服务(Task 6 落地)
|
||||
MeetingController *meetingController.MeetingController // 会议 REST 控制器
|
||||
MeetingWSHandler *meetingController.MeetingWSHandler // 会议 WS 事件 Handler(构造时自动注册路由到 Hub)
|
||||
}
|
||||
|
||||
// NewApp 创建应用实例
|
||||
@@ -86,7 +88,9 @@ func NewApp(
|
||||
notifyCtrl *notifyController.NotificationController,
|
||||
notifyCleanup *notifyTask.CleanupTask,
|
||||
meetingSvc *meetingService.MeetingService,
|
||||
meetingSignalSvc *meetingService.MeetingSignalService,
|
||||
meetingCtrl *meetingController.MeetingController,
|
||||
meetingWSHandler *meetingController.MeetingWSHandler,
|
||||
) *App {
|
||||
wsHandler.SetOfflinePusher(offlinePusher)
|
||||
wsHandler.SetNotifyConnectHook(notifySvc)
|
||||
@@ -118,7 +122,9 @@ func NewApp(
|
||||
NotifyController: notifyCtrl,
|
||||
NotifyCleanupTask: notifyCleanup,
|
||||
MeetingService: meetingSvc,
|
||||
MeetingSignalService: meetingSignalSvc,
|
||||
MeetingController: meetingCtrl,
|
||||
MeetingWSHandler: meetingWSHandler,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,9 +101,12 @@ func InitializeApp(cfg *config.Config) (*App, error) {
|
||||
meetingRoomDAO := dao6.NewMeetingRoomDAO(gormDB)
|
||||
meetingParticipantDAO := dao6.NewMeetingParticipantDAO(gormDB)
|
||||
meetingChatDAO := dao6.NewMeetingChatDAO(gormDB)
|
||||
meetingBroadcaster := service7.NewMeetingBroadcaster(meetingParticipantDAO, pubSub)
|
||||
noopMediaOrchestrator := service7.NewNoopMediaOrchestrator()
|
||||
meetingService := service7.NewMeetingService(meetingRoomDAO, meetingParticipantDAO, meetingChatDAO, gormDB, client, pubSub, notifyService, friendshipDAO, onlineService, noopMediaOrchestrator)
|
||||
meetingService := service7.NewMeetingService(meetingRoomDAO, meetingParticipantDAO, meetingChatDAO, gormDB, client, meetingBroadcaster, notifyService, friendshipDAO, onlineService, noopMediaOrchestrator)
|
||||
meetingSignalService := service7.NewMeetingSignalService(meetingRoomDAO, meetingParticipantDAO, client, meetingBroadcaster, noopMediaOrchestrator)
|
||||
meetingController := controller7.NewMeetingController(meetingService)
|
||||
app := NewApp(cfg, gormDB, client, minioClient, authService, authController, adminAuthController, userManageController, onlineController, contactManageController, groupManageController, messageManageController, handler, hub, pubSub, onlineService, contactController, imController, eventHandler, offlinePusher, fileController, groupController, notifyService, notificationController, cleanupTask, meetingService, meetingController)
|
||||
meetingWSHandler := controller7.NewMeetingWSHandler(meetingSignalService, hub)
|
||||
app := NewApp(cfg, gormDB, client, minioClient, authService, authController, adminAuthController, userManageController, onlineController, contactManageController, groupManageController, messageManageController, handler, hub, pubSub, onlineService, contactController, imController, eventHandler, offlinePusher, fileController, groupController, notifyService, notificationController, cleanupTask, meetingService, meetingSignalService, meetingController, meetingWSHandler)
|
||||
return app, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user