stop method

Future<void> stop()

Gracefully shuts down the server.

Implementation

Future<void> stop() async {
  if (_status != ServerStatus.running) return;
  _status = ServerStatus.stopping;
  await _httpServer?.close();
  _httpServer = null;
  _sessions.clear();
  _rateLimits.clear();
  _status = ServerStatus.stopped;
}