Files
EchoChat/backend/go-service/app/provider/wire.go
bujinyuan bfb4fb0ccb feat(ws): WebSocket 核心模块(Hub + Client + PubSub + Handler)
- pkg/ws/message.go: 统一消息协议(Message/Response/PushMessage)
- pkg/ws/hub.go: Hub 连接管理(注册/注销/按 userID 查找/在线计数)
- pkg/ws/client.go: 客户端连接封装(readPump/writePump/心跳 30s)
- pkg/ws/pubsub.go: Redis Pub/Sub 消息路由(按用户频道发布/订阅)
- app/ws/handler.go: WebSocket 升级处理(JWT 认证 + 消息分发)
- app/ws/router.go: GET /ws 路由注册
- app/ws/provider.go: Wire Provider Set
- 更新 provider/router 集成 WebSocket 模块

Made-with: Cursor
2026-03-02 16:46:17 +08:00

24 lines
512 B
Go
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.

//go:build wireinject
// Package provider 提供 Wire 依赖注入入口
package provider
import (
"github.com/echochat/backend/app/admin"
"github.com/echochat/backend/app/auth"
wsApp "github.com/echochat/backend/app/ws"
"github.com/echochat/backend/config"
"github.com/google/wire"
)
// InitializeApp 初始化整个应用Wire 自动生成实现)
func InitializeApp(cfg *config.Config) (*App, error) {
wire.Build(
InfraSet,
auth.AuthSet,
admin.AdminSet,
wsApp.WSSet,
)
return nil, nil
}