From 2c41f590640457334aed14097e8e78fb90960110 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 24 Aug 2023 11:43:16 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/datatransferlogic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 553f4123..9c2de077 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -87,9 +87,9 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) //有token是正常用户,无则是白板用户,也可以连接 if token != "" { r.Header.Set("Authorization", "Bearer "+token) + //设置Sec-Websocket-Protocol + upgrader.Subprotocols = []string{token} } - //设置Sec-Websocket-Protocol - upgrader.Subprotocols = []string{token} //升级websocket conn, err := upgrader.Upgrade(w, r, nil) if err != nil {