safeSend method

Future<void> safeSend(
  1. Request message
)

Safely send a message to ROS.

Implementation

Future<void> safeSend(Request message) async {
  // Send the message but if we're not connected and the [reconnectOnClose] flag
  // is set, wait for ROS to reconnect and then resend the [message].
  ros.send(message);
  if (reconnectOnClose && ros.status != Status.connected) {
    await ros.statusStream.firstWhere((s) => s == Status.connected);
    ros.send(message);
  }
}