getStatistics method
Get connection statistics
Implementation
Map<String, dynamic> getStatistics() {
final activeCount = getActiveConnections().length;
final totalQueue = _connections.values
.map((conn) => conn.getQueueStats()['size'] as int)
.fold(0, (sum, size) => sum + size);
final totalSent = _connections.values
.map((conn) => conn.messagesSent)
.fold(0, (sum, sent) => sum + sent);
final totalReceived = _connections.values
.map((conn) => conn.messagesReceived)
.fold(0, (sum, received) => sum + received);
return {
'totalConnections': _connections.length,
'activeConnections': activeCount,
'totalQueueSize': totalQueue,
'totalMessagesSent': totalSent,
'totalMessagesReceived': totalReceived,
'maxConnections': config.maxConnections,
};
}