stop method

Future<void> stop()

Stops the STOMP server

Implementation

Future<void> stop() async {
  if (!_isRunning) return;

  _isRunning = false;

  // Close all connections
  final connectionList = List<StompServerConnection>.from(_connections.values);
  for (final connection in connectionList) {
    await connection.close();
  }

  _connections.clear();
  _peerConnections.clear();
  _destinationSubscriptions.clear();
  _destinationMessages.clear();

  _connectionController.close();
  _disconnectionController.close();
  _messageController.close();

  _logger.info('STOMP server stopped');
}