From 45d52d0089e4131e93b3652fa3075fc57004760a Mon Sep 17 00:00:00 2001 From: locxiang <921223344@qq.com> Date: Fri, 10 Aug 2018 00:57:06 +0800 Subject: [PATCH] Update service_websocket.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复ws错误: close 1008 (policy violation): {\"code\":-1,\"msg\":\"Illegal format ws or stream\"} --- service_websocket.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_websocket.go b/service_websocket.go index f20f2ee..2ae9a52 100644 --- a/service_websocket.go +++ b/service_websocket.go @@ -412,7 +412,7 @@ func (as *apiService) exitHandler(c *websocket.Conn, done chan struct{}) { for { select { case t := <-ticker.C: - err := c.WriteMessage(websocket.TextMessage, []byte(t.String())) + err := c.WriteMessage(websocket.PingMessage, []byte(t.String())) if err != nil { level.Error(as.Logger).Log("wsWrite", err) return