History

Reading past messages and past presence events over HTTP.

Messages

GET /api/channels/:channel/history?limit=100

Capability: history on that channel. limit defaults to 100.

{
  "messages": [
    {
      "channel": "chat:lobby",
      "name": "message",
      "data": { "text": "hello" },
      "connectionId": "conn-…",
      "timestamp": 1710000000000
    }
  ]
}

Newest first.

curl "$BLACKEVIN/api/channels/chat%3Alobby/history?limit=50" -H "authorization: $AUTH"
const messages = await rest.channels.get('chat:lobby').history({ limit: 50 });

Presence events

GET /api/channels/:channel/presence/history?limit=100

Capability: history — not presence. Reading the past is one permission whatever it is the past of.

{
  "events": [
    {
      "channel": "chat:lobby",
      "action": "enter",
      "clientId": "alice",
      "connectionId": "conn-…",
      "data": { "status": "online" },
      "timestamp": 1710000000000
    }
  ]
}

action is enter, leave or update.

const events = await rest.channels.get('chat:lobby').presence.history({ limit: 100 });

If the node has no presence-history store wired, this answers { "events": [] } rather than failing. An empty list means "nothing recorded", which on a node without persistence is always true.

What gets written

Both logs are appended on the origin event only. A message or presence event forwarded to another node in a cluster is not persisted a second time, and a rewind delivery is not persisted at all — otherwise every replay would grow the log it just read.

Reads are side-effect free.

Storage

Messages are partitioned by day on their event time and read newest-first. There is no Ably-style hard cap in the schema; how far back you can read depends on the retention configured for your account.

On this page