AWSHubPlugin
public final 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.
-
Convenience property. Each instance of
AWSHubPluginhas the same keyDeclaration
Swift
public static var key: String { get }
-
Declaration
Swift
public var key: String { get } -
For protocol conformance only–this plugin has no applicable configurations
Declaration
Swift
public func configure(using configuration: Any?) throws -
reset()AsynchronousRemoves listeners and empties the message queue
Declaration
Swift
public func reset() async -
Declaration
Swift
public func dispatch(to channel: HubChannel, payload: HubPayload) -
Declaration
Swift
public func listen( to channel: HubChannel, eventName: HubPayloadEventName, listener: @escaping HubListener ) -> UnsubscribeToken -
Declaration
Swift
public func listen( to channel: HubChannel, isIncluded filter: HubFilter? = nil, listener: @escaping HubListener ) -> UnsubscribeToken -
Declaration
Swift
public func removeListener(_ token: UnsubscribeToken)
-
Returns true if the dispatcher has a listener registered with
tokenDeclaration
Swift
public func hasListener(withToken token: UnsubscribeToken) -> BoolParameters
tokenThe UnsubscribeToken of the listener to check
Return Value
True if the dispatcher has a listener registered with
token
View on GitHub