void close()

Source

void close() {
  _onConnectedCompleter = new Completer();
  if (_closed) return;
  _closed = true;
  if (_wsConnection != null) {
    _wsConnection.close();
    _wsConnection = null;
  }
}