This commit is contained in:
richboo111
2023-04-27 11:55:54 +08:00
parent d775e408eb
commit a2e183b5b9
3 changed files with 20 additions and 13 deletions

View File

@@ -16,11 +16,8 @@ func Init() {
//初始化
ToClientChan = make(chan clientInfo, 1000)
//写入全局变量
//Default()
Setup()
//建立长链接
//StartWebSocket(res, req)
go Send([]byte(HeartCheckMsg))
//启动定时器
@@ -51,7 +48,8 @@ func Run(w http.ResponseWriter, r *http.Request) {
//设置读取消息大小上线
conn.SetReadLimit(maxMessageSize)
clientID := r.FormValue("clientId")
//clientID := r.FormValue("clientId")
clientID := r.Header.Get("Clientid")
clientSocket := NewClient(clientID, conn)
//读取客户端消息
@@ -164,6 +162,7 @@ func (c *Client) Read() {
}
} else {
SendToVendor(msg)
return
}
}
}()