void close()

Source

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