HubCategoryBehavior
public protocol HubCategoryBehavior
Behavior of the Hub category that clients will use
-
Dispatch a Hub message on the specified channel
Declaration
Swift
func dispatch(to channel: HubChannel, payload: HubPayload)Parameters
channelThe channel to send the message on
payloadThe payload to send
-
Listen to Hub messages with a particular event name on a particular channel
Declaration
Swift
func listen( to channel: HubChannel, eventName: HubPayloadEventName, listener: @escaping HubListener ) -> UnsubscribeTokenParameters
channelThe channel to listen for messages on
eventNameOnly hub payloads with this event name will be dispatched to the listener
listenerThe closure to invoke with the received message
-
Listen to Hub messages on a particular channel, optionally filtering message prior to dispatching them
Declaration
Swift
func listen( to channel: HubChannel, isIncluded filter: HubFilter?, listener: @escaping HubListener ) -> UnsubscribeTokenParameters
channelThe channel to listen for messages on
filterIf specified, candidate messages will be passed to this closure prior to dispatching to the
listener. Only messages for which the filter returnstruewill be dispatched.listenerThe closure to invoke with the received message
-
Removes the listener identified by
tokenDeclaration
Swift
func removeListener(_ token: UnsubscribeToken)Parameters
tokenThe UnsubscribeToken returned by
listen -
publisher(for:Extension method) Returns a publisher for all Hub messages sent to
channelDeclaration
Swift
public func publisher(for channel: HubChannel) -> HubPublisherParameters
channelThe channel to listen for messages on
View on GitHub