ObjCCompat_SubscriptionHandling

@objc(PFLiveQuerySubscriptionHandling)
public protocol ObjCCompat_SubscriptionHandling

This protocol describes the interface for handling events from a live query client.

You can use this protocol on any custom class of yours, instead of Subscription, if it fits your use case better.

  • Tells the handler that an event has been received from the live query server.

    Declaration

    Swift

    @objc(liveQuery:didRecieveEvent:inClient:)
    optional func didRecieveEvent(_ query: PFQuery<PFObject>, event: PFLiveQueryEvent, client: Client)

    Parameters

    query

    The query that the event occurred on.

    event

    The event that has been recieved from the server.

    client

    The live query client which received this event.

  • Tells the handler that an error has been received from the live query server.

    Declaration

    Swift

    @objc(liveQuery:didEncounterError:inClient:)
    optional func didRecieveError(_ query: PFQuery<PFObject>, error: NSError, client: Client)

    Parameters

    query

    The query that the error occurred on.

    error

    The error that the server has encountered.

    client

    The live query client which received this error.

  • Tells the handler that a query has been successfully registered with the server.

    Note

    This may be invoked multiple times if the client disconnects/reconnects.

    Declaration

    Swift

    @objc(liveQuery:didSubscribeInClient:)
    optional func didSubscribe(_ query: PFQuery<PFObject>, client: Client)

    Parameters

    query

    The query that has been subscribed.

    client

    The live query client which subscribed this query.

  • Tells the handler that a query has been successfully deregistered from the server.

    Note

    This is not called unless unregister() is explicitly called.

    Declaration

    Swift

    @objc(liveQuery:didUnsubscribeInClient:)
    optional func didUnsubscribe(_ query: PFQuery<PFObject>, client: Client)

    Parameters

    query

    The query that has been unsubscribed.

    client

    The live query client which unsubscribed this query.