func (h runHandlers) doSendPingMessage(ws *websocket.Conn, logger *logrus.Entry) bool {
	//logger.Debug("pinging websocket client")

	// We cannot return error here, if we do echo will try to write the error to conn
	// and we closed the ws with a defer func. So we return a bool, if it falsey the caller
	// should terminate the WebSocket connection.

	writeTimeout := time.Now().Add(writeTimeout)
	if err := ws.SetWriteDeadline(writeTimeout); err != nil {
		logger.WithError(err).Error("SetWriteDeadline failed")
		return false
	}
	if err := ws.WriteMessage(websocket.PingMessage, nil); err != nil {
		logger.WithError(err).Error("WriteMessage failed")
		return false
	}
	return true
}
// doSendPingMessage - If false, caller should terminate WebSocket connection.
If false, caller should terminate WebSocket connection.
// doSendPingMessage - If false caller should terminate WebSocket connection .
func (h runHandlers) doSendPingMessage(ws *websocket.Conn, logger *logrus.Entry) bool {
	writeTimeout := time.Now().Add(writeTimeout)
	if err := ws.SetWriteDeadline(writeTimeout); err != nil {
		logger.WithError(err).Error("SetWriteDeadline failed")
		return false
	}
	if err := ws.WriteMessage(websocket.PingMessage, nil); err != nil {
		logger.WithError(err).Error("WriteMessage failed")
		return false
	}
	return true
}
func ( h runHandlers ) doSendPingMessage ( ws * websocket . Conn , logger * logrus . Entry ) bool { writeTimeout := time . Now ( ) . Add ( writeTimeout ) if err := ws . SetWriteDeadline ( writeTimeout ) ; err != nil { logger . WithError ( err ) . Error ( " " ) return false } if err := ws . WriteMessage ( websocket . PingMessage , nil ) ; err != nil { logger . WithError ( err ) . Error ( " " ) return false } return true }
If false, caller should terminate WebSocket connection.
If false caller should terminate WebSocket connection .
//logger.Debug("pinging websocket client") // We cannot return error here, if we do echo will try to write the error to conn // and we closed the ws with a defer func. So we return a bool, if it falsey the caller // should terminate the WebSocket connection.