Instance Method
psubscribe(to:messageReceiver:onSubscribe:onUnsubscribe:)
func psubscribe(to patterns: [String], messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver, onSubscribe subscribeHandler: RedisSubscriptionChangeHandler?, onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler?) -> EventLoopFuture<Void>
Parameters
patternsA list of glob patterns used for matching against PubSub channel names to subscribe to.
receiverA closure which will be invoked each time a channel with a name matching the specified pattern(s) publishes a message.
subscribeHandlerAn optional closure to be invoked when the subscription becomes active.
unsubscribeHandlerAn optional closure to be invoked when the subscription becomes inactive.
Return Value
A notification NIO.EventLoopFuture that resolves once the subscription has been registered with Redis.
Discussion
Note
If the client is also subscribed to a channel directly by name which also matches a pattern, both subscription message receivers will be invoked.
See PSUBSCRIBE
Important
This will establish the client in a “PubSub mode” where only a specific list of commands are allowed to be executed.
Commands issues with this client outside of that list will resolve with failures.
See the PubSub specification