DataSubscription

public final class DataSubscription : CustomDebugStringConvertible
extension DataSubscription: WebcomCombinable

An object representing a subscription to Data events.

Instances are created by the DataNode.subscribeThroughNotifications(descriptor:file:line:session:queue:then:) and the DataNode.subscribeThroughWebhook(_:context:descriptor:file:line:session:queue:then:) methods.

API

  • Cancels this subscription.

    It is also possible to cancel a subscription using the DataNode.unsubscribeThroughNotifications(session:queue:then:) method or the DataNode.unsubscribeThroughWebhook(_:context:session:queue:then:) method, depending on the method used to subscribe. On the contrary, this method works in all cases, provided the returned subscription instance has been kept.

    Declaration

    Swift

    public func cancel(session: URLSession? = nil, queue: DispatchQueue? = nil, then completionCallback: WebcomResult<Void>.Callback? = nil)

    Parameters

    session

    The session used to send the request to the back-end. When nil, the default session of the application of this instance is used.

    queue

    The queue to which the provided callback dispatches. When nil, the default callback queue of the application of this instance is used.

    completionCallback

    The closure to call upon completion. In case of success, it is called with a void value. In case of failure, it is called with a WebcomError value indicating the reason of the failure.

CustomDebugStringConvertible Protocol

  • Declaration

    Swift

    public var debugDescription: String { get }

Combine Module

  • The type that wraps DataSubscription in order to enrich it with a Combine-based API.

    See also the documentation section of WebcomWrapper for the corresponding wrapped type.

    To use this type, import the following dependency in your code:

    import WebcomCombine
    
    See more

    Declaration

    Swift

    public final class CombineWrapper : WebcomWrapper, CustomDebugStringConvertible
  • The wrapping instance, which has a Combine-based API.

    Declaration

    Swift

    public var forCombine: CombineWrapper { get }