ws
This commit is contained in:
@@ -2,8 +2,6 @@ package controllers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/im"
|
||||
@@ -20,15 +18,15 @@ type IMController struct {
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /StartWebSocket [get]
|
||||
func (c *IMController) StartWebSocket() {
|
||||
|
||||
ws, err := upgrader.Upgrade(c.Ctx.ResponseWriter, &http.Request{
|
||||
Method: "GET",
|
||||
Header: http.Header{
|
||||
"Upgrade": []string{"websocket"},
|
||||
"Connection": []string{"upgrade"},
|
||||
"Sec-Websocket-Key": []string{"dGhlIHNhbXBsZSBub25jZQ=="},
|
||||
"Sec-Websocket-Version": []string{"13"},
|
||||
}}, nil)
|
||||
ws, err := upgrader.Upgrade(c.Ctx.ResponseWriter, c.Ctx.Request, nil)
|
||||
//ws, err := upgrader.Upgrade(c.Ctx.ResponseWriter, &http.Request{
|
||||
// Method: "GET",
|
||||
// Header: http.Header{
|
||||
// "Upgrade": []string{"websocket"},
|
||||
// "Connection": []string{"upgrade"},
|
||||
// "Sec-Websocket-Key": []string{"dGhlIHNhbXBsZSBub25jZQ=="},
|
||||
// "Sec-Websocket-Version": []string{"13"},
|
||||
// }}, nil)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Errorf("upgrade error: %v", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user