broadcastMessage method
Send a message to all connected peers
Implementation
Future<List<String>> broadcastMessage(WireMessage message) async {
final activeConnections = getActiveConnections();
final successful = <String>[];
logger.fine('Broadcasting ${message.command} to ${activeConnections.length} peers');
for (final connection in activeConnections) {
try {
await connection.sendMessage(message);
successful.add(connection.toString());
} catch (e) {
logger.warning('Failed to send ${message.command} to ${connection}: $e');
}
}
return successful;
}