Type Aliases

The following type aliases are available globally.

  • A closure receiver of individual Pub/Sub messages from Redis subscriptions to channels and patterns.

    Warning

    The receiver is called on the same NIO.EventLoop that processed the message.

    If you are doing non-trivial work in response to PubSub messages, it is highly recommended that the work be dispatched to another thread so as to not block further messages from being processed.

    Declaration

    Swift

    public typealias RedisSubscriptionMessageReceiver = (_ publisher: RedisChannelName, _ message: RESPValue) -> Void

    Parameters

    publisher

    The name of the channel that published the message.

    message

    The message data that was received from the publisher.

  • A closure handler invoked for Pub/Sub subscription changes.

    This closure will be invoked only once for each individual channel or pattern that is having its subscription changed, even if it was done as a single PSUBSCRIBE, SUBSCRIBE, PUNSUBSCRIBE, or UNSUBSCRIBE command.

    Warning

    The receiver is called on the same NIO.EventLoop that processed the message.

    If you are doing non-trivial work in response to PubSub messages, it is highly recommended that the work be dispatched to another thread so as to not block further messages from being processed.

    Declaration

    Swift

    public typealias RedisSubscriptionChangeHandler = (_ subscriptionKey: String, _ currentSubscriptionCount: Int) -> Void

    Parameters

    subscriptionKey

    The subscribed channel or pattern that had its subscription status changed.

    currentSubscriptionCount

    The current total number of subscriptions the connection has.