send method

  1. @override
Future send(
  1. String name,
  2. String value,
  3. DateTime time
)
override

Sends the given measurement to the server.

Implementation

@override
Future send(String name, String value, DateTime time) {
  var timeInSeconds =
      time.millisecondsSinceEpoch ~/ Duration.millisecondsPerSecond;
  sanitize(String s) => s.replaceAll(RegExp(r'\s+'), '-');
  if (!isConnected) connect();
  return _socket!.then((sock) {
    sock.writeln('${sanitize(name)} ${sanitize(value)} $timeInSeconds');
    _failures = 0;
  }).catchError((_) {
    _failures++;
  });
}