Not every message in a realtime app needs to be available in message history, like in the rewind backlog or in persistent storage. Ably is introducing ephemeral messages to let you deliver transient updates - like reactions, typing indicators, or cursor positions - which are only delivered to clients that are connected at the moment the message is published.
The challenges of handling ephemeral messages
Message history
Interweaving ephemeral messages, alongside the usual persistent messages published on a channel, are crucial to a realtime app’s performance. Imagine forgoing ephemeral messages for simplicity’s sake: you might decide to straightforwardly send all events as regular messages over a channel. But this has the unpleasant side effect of storing all messages, even transient ones, into message history - where they take up significant space. They’re also forwarded to integration endpoints like webhooks or queues, despite having no long-term value. This adds noise to the integration and requires unnecessary filtering on your part.
Efficiency implications
A bloated message history can lead to inefficiency in some use cases. For example, if you’re using rewind=100 to preload the last hundred messages for users reconnecting or joining a session, ephemeral events like typing indicators or reactions can dominate that buffer. If 70 of those 100 messages are momentary signals, your users may only see 30 actual, meaningful messages in their history leading to a poor experience. Worse still, these transient messages are treated the same as persistent ones in terms of billing.
Architectural complexity
One workaround is to route ephemeral messages through a separate channel, configured without persistence or integrations. While this works, it adds architectural overhead and complexity: you now need to manage multiple channels, set up different capabilities, and track more moving parts.
Keep the messages that count
To make these kinds of transient events easier for you to handle, we've introduced ephemeral messages - a lightweight mechanism for sending transient updates without polluting your system.
By marking a message as ephemeral, you exempt it from:
- Being stored in persisted history
- Appearing in rewind buffers for new subscribers
- Being included when clients resume after disconnection
- Being sent to integrations like webhooks, queues, or the firehose

In other words, ephemeral messages are delivered only to currently-connected clients in realtime - and then disappear.
They still count as messages in terms of throughput, but because they're excluded from the message history, they can save on the costs of retrieving messages from history.
To mark a message as ephemeral, either include ephemeral: true
in the message's extras object, or (for REST publishes) include ephemeral: true
in the publish parameters. For example:
const channel = realtime.channels.get('chatroom');
await channel.publish({name: 'emote', data: ':heart:', extras: { ephemeral: true }});
or
const channel = rest.channels.get('chatroom');
await channel.publish('emote', ':heart:', { ephemeral: true });
Get started with ephemeral messages
Ephemeral messages are available now in Ably Pub/Sub. Head to our docs to quickly walk through the process. If you have any questions, please get in touch! We’ll be happy to help.