disconnect method

Future<void> disconnect()
inherited

Close the WebSocket connection and drop all active subscriptions client-side. Use this instead of calling RealtimeSubscription.unsubscribe on every subscription when you want to tear everything down.

Implementation

Future<void> disconnect() async {
  for (var subscription in _subscriptions.values) {
    await subscription.controller.close();
  }
  _subscriptions.clear();
  _pendingSubscribes.clear();
  await _closeConnection();
  _reconnect = true; // allow future subscribeTo() calls to reconnect
}