dispose method

  1. @override
void dispose()

Implementation

@override
void dispose() {
  if (_negotiator != null) {
    _negotiator?.cleanup();
    _negotiator = null;
  }

  dataChannel?.onDataChannelState = null;
  dataChannel?.onMessage = null;
  _dc = null;

  if (!open) {
    return;
  }

  open = false;

  close();
}