close method

Future<void> close()

Closes the WebSocket connection.

Implementation

Future<void> close() async {
  if (_closed) return;
  _closed = true;
  _generation++;
  try {
    await _core.close().timeout(const Duration(seconds: 1),
        onTimeout: () {});
  } finally {
    _closeController();
  }
}