Skip to main content

Arguments

streams
Dict[str, str]
required
A dictionary mapping stream keys to their starting IDs. Use ”$” to read only new messages added after the command is issued.
count
int
The maximum number of messages to return per stream.

Response

Returns a list where each element represents a stream and contains:
  • The stream key
  • A list of messages (ID and field-value pairs)
Returns empty list if no data is available.
result = redis.xread({"mystream": "0-0"})
[
  ["mystream", [
    ["1638360173533-0", ["field1", "value1", "field2", "value2"]],
    ["1638360173533-1", ["field1", "value3", "field2", "value4"]]
  ]]
]
I