This commit is contained in:
laodaming 2023-08-24 11:43:16 +08:00
parent 724b842167
commit 2c41f59064

View File

@ -87,9 +87,9 @@ func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request)
//有token是正常用户无则是白板用户也可以连接 //有token是正常用户无则是白板用户也可以连接
if token != "" { if token != "" {
r.Header.Set("Authorization", "Bearer "+token) r.Header.Set("Authorization", "Bearer "+token)
}
//设置Sec-Websocket-Protocol //设置Sec-Websocket-Protocol
upgrader.Subprotocols = []string{token} upgrader.Subprotocols = []string{token}
}
//升级websocket //升级websocket
conn, err := upgrader.Upgrade(w, r, nil) conn, err := upgrader.Upgrade(w, r, nil)
if err != nil { if err != nil {