close method
Implementation
@override
Future<void> close() async {
if (_closed) return;
_closed = true;
await _rxSub?.cancel();
_rxSub = null;
final s = _socket;
_socket = null;
if (s != null) {
try {
await s.close();
} on Object {
// Best-effort.
}
s.destroy();
}
if (!_rxCtrl.isClosed) {
await _rxCtrl.close();
}
}