stop method

Future<void> stop()

Stops serving and releases the event source / broker connections.

Implementation

Future<void> stop() async {
  _queuePoll?.cancel();
  _queuePoll = null;
  for (final c in _sseClients.toList()) {
    try {
      await c.close();
    } catch (_) {}
  }
  _sseClients.clear();
  await _server?.close(force: true);
  _server = null;
  await state.close();
  await source.close();
  await broker?.close();
}