Subscribe to the raw Ably.InboundMessage stream from the transport's tree. Messages are appended in arrival order. Use when you need to inspect channel-level metadata (serials, raw headers) that the codec layer would otherwise hide. Most applications should use useView instead, which returns decoded domain messages.
This hook must be used within a TransportProvider or a ChatTransportProvider.
React
1
2
3
4
5
6
import { useAblyMessages } from '@ably/ai-transport/react';
function RawLog() {
const messages = useAblyMessages();
return <pre>{messages.map((m) => `${m.serial} ${m.name}`).join('\n')}</pre>;
}Parameters
transportoptionalClientTransport<TEvent, TMessage>Transport to subscribe to. Defaults to the nearest provider when omitted.
skipoptionalBooleanWhen
true, skip all subscriptions and return an empty array.Returns
Ably.InboundMessage[]
The accumulated raw Ably messages in chronological order. The array grows as messages arrive.
Example
React
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { useAblyMessages } from '@ably/ai-transport/react';
function ChannelTrace() {
const raw = useAblyMessages();
return (
<ul>
{raw.map((m) => (
<li key={m.serial}>
<code>{m.serial}</code> {m.name} ({m.action})
</li>
))}
</ul>
);
}