respond method

Future<void> respond(
  1. String data
)

Implementation

Future<void> respond(String data) async {
  try {
    if (isConnected) {
      String header = generateHeaderForXML(data);
      String request = header + data;

      // XmlDocument formattedDOC = XmlDocument.parse(data);
      // String formattedXML = formattedDOC.toXmlString(pretty: true, preserveWhitespace: (_) => true);
      String formattedXML = formatXMLString(data);

      Logger.writeToLog(formattedXML, from: "Application", to: logIdentifier, logSuffix: logSuffix,header: header);
      _socket!.write(request);
    } else {
      log("Socket Closed");
    }
  } catch (e) {
    log("responding to Socket ERROR: $e");
    rethrow;
  }
}