From a72aa2feca66c0d57ab3b216ff49a364d447eb1f Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 23 Aug 2023 12:29:59 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/datatransferlogic.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 33a9b39e..f5c3e3c3 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -45,7 +45,7 @@ var ( }, } //升级websocket - upgrade = websocket.Upgrader{ + upgrader = websocket.Upgrader{ //最大可读取大小 10M ReadBufferSize: 1024 * 10, //握手超时时间15s @@ -86,9 +86,9 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) token := r.Header.Get("Sec-Websocket-Protocol") r.Header.Set("Authorization", "Bearer "+token) //设置Sec-Websocket-Protocol - upgrade.Subprotocols = []string{token} + upgrader.Subprotocols = []string{token} //升级websocket - conn, err := upgrade.Upgrade(w, r, nil) + conn, err := upgrader.Upgrade(w, r, nil) if err != nil { logx.Error("http upgrade websocket err:", err) return