Files
customer-server/controller/account_websocket_controller.go

27 lines
830 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.
// Package controller - WebSocket控制器
// 功能WebSocket连接管理、实时消息推送
package controller
import (
"context"
"customer-server/model/dto"
"customer-server/service"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
var AccountWebsocket = new(accountWebSocket)
type accountWebSocket struct{}
// Connect WebSocket连接
// 参数: req - WebSocket连接请求包含用户ID和平台信息
// 返回: res - 连接结果实际通过WebSocket协议通信
// 功能: 升级HTTP连接为WebSocket建立实时通信通道
func (c *accountWebSocket) Connect(ctx context.Context, req *dto.AccountWebSocketConnectReq) (res *beans.ResponseEmpty, err error) {
r := g.RequestFromCtx(ctx)
err = service.AccountWebSocket.Connect(ctx, r, req.AccountName, req.Platform)
return
}