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