{
  "schema_version": 2,
  "id": "commands/sunsubscribe",
  "title": "SUNSUBSCRIBE",
  "url": "https://redis.io/docs/latest/commands/sunsubscribe/",
  "summary": "Stops listening to messages posted to shard channels.",
  "since": "7.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T16:45:25+01:00",
  "page_type": "content",
  "content_hash": "45f85b7b647777eef3bf5c6a12d57a55ff375a08cac2978b206cc53527a20730",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Unsubscribes the client from the specified patterns, or from all patterns if none are specified.\n\nIf you don’t specify any shard channels, the client unsubscribes from all previously subscribed shard channels. The client receives one message for each shard channel it unsubscribes from.\n\nNote: global channels and shard channels need to be unsubscribed from separately.\n\nFor more information about sharded Pub/Sub, see [Sharded Pub/Sub](https://redis.io/docs/latest/develop/pubsub#sharded-pubsub)."
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>shardchannel [shardchannel ...]</code></summary>\n\nOne or more shard channels to unsubscribe from. If omitted, the client is unsubscribed from all shard channels.\n\n</details>"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nWhen successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string `sunsubscribe` is pushed as a confirmation that the command succeeded.\n\n**RESP3:**\n\nWhen successful, this command doesn't return anything. Instead, for each shard channel, one message with the first element being the string `sunsubscribe` is pushed as a confirmation that the command succeeded."
    }
  ],
  "examples": []
}
