Skip to main content

Arguments

key
string | string[]
required
The key(s) of the stream(s). Can be a single stream key or an array of stream keys.
id
string | string[]
required
The stream entry ID(s) to start reading from. Must match the number of keys provided. Use ”$” to read only new messages added after the command is issued.
options

Response

Returns an array where each element represents a stream and contains:
  • The stream key
  • An array of messages (ID and field-value pairs)
Returns null if no data is available.
const result = await redis.xread("mystream", "0-0");
[
  ["mystream", [
    ["1638360173533-0", ["field1", "value1", "field2", "value2"]],
    ["1638360173533-1", ["field1", "value3", "field2", "value4"]]
  ]]
]
I