stop method

Future<void> stop()

Stops the STOMP service

Implementation

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

  _logger.info('Stopping STOMP service');

  // Close all clients
  final clientList = List<StompClient>.from(_clients.values);
  for (final client in clientList) {
    await client.close();
  }
  _clients.clear();

  // Stop server
  if (_server != null) {
    await _server!.stop();
    _server = null;
    _logger.info('STOMP server stopped');
  }

  _isStarted = false;
  _logger.info('STOMP service stopped');
}