Skip to main content
Use UNSUBSCRIBE to cancel channel subscriptions of the current connection. With no arguments the connection unsubscribes from every channel it is subscribed to, otherwise only from the ones named. The server sends one confirmation per channel, each carrying the number of subscriptions still active, and the connection leaves subscriber mode once that count reaches zero. Pattern subscriptions are not affected; cancel those with PUNSUBSCRIBE.

Syntax

Arguments

Important points

  • This is a connection-oriented command and is available over native Redis TCP, not the stateless REST endpoint.
  • Subscription commands require a dedicated TCP connection. In RESP3, subscription events use push replies.

Response

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.