unSubscribe<T extends ParseObject> method

void unSubscribe<T extends ParseObject>(
  1. Subscription<T> subscription
)

Implementation

void unSubscribe<T extends ParseObject>(Subscription<T> subscription) {
  //Mount message for Unsubscribe
  final Map<String, dynamic> unsubscribeMessage = <String, dynamic>{
    'op': 'unsubscribe',
    'requestId': subscription.requestId,
  };
  WebSocketChannel? channel = _channel;
  if (channel != null) {
    if (_debug) {
      print('$_printConstLiveQuery: UnsubscribeMessage: $unsubscribeMessage');
    }
    channel.sink.add(jsonEncode(unsubscribeMessage));
    subscription._enabled = false;
    _requestSubscription.remove(subscription.requestId);
  }
}