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 {