SubscriptionHandling

public protocol SubscriptionHandling : AnyObject

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

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

  • The type of the PFObject subclass that this handler uses.

    Declaration

    Swift

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

    Declaration

    Swift

    func didReceive(_ event: Event<PFObjectSubclass>, forQuery query: PFQuery<PFObjectSubclass>, inClient client: Client)

    Parameters

    event

    The event that has been recieved from the server.

    query

    The query that the event occurred on.

    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

    func didEncounter(_ error: Error, forQuery query: PFQuery<PFObjectSubclass>, inClient client: Client)

    Parameters

    error

    The error that the server has encountered.

    query

    The query that the error occurred on.

    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

    func didSubscribe(toQuery query: PFQuery<PFObjectSubclass>, inClient 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

    func didUnsubscribe(fromQuery query: PFQuery<PFObjectSubclass>, inClient client: Client)

    Parameters

    query

    The query that has been unsubscribed.

    client

    The live query client which unsubscribed this query.