disconnect method
Future
disconnect(
{ - bool userInitialized = false,
})
Implementation
Future<dynamic> disconnect({bool userInitialized = false}) async {
parse_web_socket.WebSocket? webSocket = _webSocket;
if (webSocket != null &&
webSocket.readyState == parse_web_socket.WebSocket.open) {
if (_debug) {
print('$_printConstLiveQuery: Socket closed');
}
await webSocket.close();
_webSocket = null;
}
WebSocketChannel? channel = _channel;
if (channel != null) {
if (_debug) {
print('$_printConstLiveQuery: close');
}
await channel.sink.close();
_channel = null;
}
_requestSubscription.values.toList().forEach((Subscription subscription) {
subscription._enabled = false;
});
_connecting = false;
if (userInitialized) {
_clientEventStreamController.sink
.add(LiveQueryClientEvent.userDisconnected);
}
}