fix
This commit is contained in:
parent
6a45b1e1e7
commit
724b842167
|
@ -84,7 +84,10 @@ type wsConnectItem struct {
|
|||
func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) {
|
||||
//把子协议携带的token设置到标准token头信息中
|
||||
token := r.Header.Get("Sec-Websocket-Protocol")
|
||||
r.Header.Set("Authorization", "Bearer "+token)
|
||||
//有token是正常用户,无则是白板用户,也可以连接
|
||||
if token != "" {
|
||||
r.Header.Set("Authorization", "Bearer "+token)
|
||||
}
|
||||
//设置Sec-Websocket-Protocol
|
||||
upgrader.Subprotocols = []string{token}
|
||||
//升级websocket
|
||||
|
|
Loading…
Reference in New Issue
Block a user