(conn *websocket.Conn)
| 165 | } |
| 166 | |
| 167 | func WritePing(conn *websocket.Conn) error { |
| 168 | now := time.Now() |
| 169 | pingMessage := map[string]interface{}{"type": "ping", "stime": now.UnixMilli()} |
| 170 | jsonVal, _ := json.Marshal(pingMessage) |
| 171 | _ = conn.SetWriteDeadline(time.Now().Add(wsWriteWaitTimeout)) // no error |
| 172 | err := conn.WriteMessage(websocket.TextMessage, jsonVal) |
| 173 | if err != nil { |
| 174 | return err |
| 175 | } |
| 176 | return nil |
| 177 | } |
| 178 | |
| 179 | func WriteLoop(conn *websocket.Conn, outputCh chan any, closeCh chan any, routeId string) { |
| 180 | ticker := time.NewTicker(wsInitialPingTime) |
no test coverage detected