修复会话安全与实时消息

This commit is contained in:
yml2213
2026-07-14 15:06:01 +08:00
parent 064af29d3b
commit 8cff2a5824
29 changed files with 1961 additions and 546 deletions
+1 -2
View File
@@ -15,9 +15,8 @@ func NewWsHandler() *WsHandler { return &WsHandler{} }
func (h *WsHandler) Connect(c *gin.Context) {
userID := middleware.GetUserID(c)
tenantID := middleware.GetTenantID(c)
role, _ := c.Get("role")
client, err := ws.Upgrade(c.Writer, c.Request, userID, tenantID, role.(string))
client, err := ws.UpgradeAgent(c.Writer, c.Request, userID, tenantID, middleware.GetRole(c))
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"code": 500, "message": "升级连接失败"})
return