boost::redis::request::unsubscribe

Appends an argument‐less UNSUBSCRIBE command to the end of the request.

Synopsis

Declared in <boost/redis/request.hpp>

void
unsubscribe();

Description

The resulting command is UNSUBSCRIBE, which unsubscribes from all the channels the connection is subscribed to. Pattern subscriptions (created by PSUBSCRIBE) are not affected.

Subscriptions removed using this function are tracked to enable PubSub state restoration. After successfully executing the request, the connection will store any newly subscribed channels and patterns. Every time a reconnection happens, a suitable SUBSCRIBE/`PSUBSCRIBE` command is issued automatically, to restore the subscriptions that were active before the reconnection.

PubSub store restoration only happens when using subscribe, unsubscribe, psubscribe or punsubscribe. Subscription commands added by push or push_range are not tracked.

Created with MrDocs