disconnect method
Implementation
@override
Future<void> disconnect() async {
final channel = _wsChannel;
final subscription = _wsSubscription;
_wsChannel = null;
_wsSubscription = null;
// Notify request waiters before waiting for the WebSocket close handshake.
unawaited(_serverMessageStream.close());
try {
await subscription?.cancel();
} finally {
if (channel != null) {
try {
await channel.sink.close();
} catch (_) {}
}
}
}