AWSHubPlugin

final public class AWSHubPlugin : HubCategoryPlugin
extension AWSHubPlugin: AmplifyVersionable

The default Hub plugin provided with the Amplify Framework

No guaranteed delivery order

AWSHubPlugin distributes messages in order to listeners, but makes no guarantees about the order in which a listener is called. This plugin does not guarantee synchronization between message delivery and listener management. In other words, the following sequence is not guaranteed to succeed:

plugin.listen(to: .custom("MyChannel") { event in print("event received: \(event)") }
plugin.dispatch(to: .custom("MyChannel"), payload: HubPayload("MY_EVENT"))

Instead, messages and listener states are guaranteed to be independently self-consistent. Callers can use hasListener(withToken:) to check that a listener has been registered.

  • key

    Convenience property. Each instance of AWSHubPlugin has the same key

    Declaration

    Swift

    public static var key: String { get }

HubCategoryPlugin

Custom Plugin methods

  • Returns true if the dispatcher has a listener registered with token

    Declaration

    Swift

    public func hasListener(withToken token: UnsubscribeToken) -> Bool

    Parameters

    token

    The UnsubscribeToken of the listener to check

    Return Value

    True if the dispatcher has a listener registered with token