react-hooks icon indicating copy to clipboard operation
react-hooks copied to clipboard

Receive last message and history

Open mandymozart opened this issue 1 year ago • 2 comments

A key feature of ably is to receive the last message, but the react hook do not expose the history. https://ably.com/docs/storage-history/storage#persist-last-message

mandymozart avatar Oct 07 '23 18:10 mandymozart

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3892

sync-by-unito[bot] avatar Oct 07 '23 18:10 sync-by-unito[bot]

Hey @mandymozart, thanks for reaching out!

You can use channel qualifier syntax to enable rewind on any channel, for example:

useChannel("[?rewind=100]your-channel-name")

If you need to use the channel history api you can do it by calling the history method on the channel instance returned by the hook, for example:

const [channel] = useChannel("your-channel-name");
const result = await channel.history(params);

Hope that clears things up, let me know if you have any further questions 🙂

owenpearson avatar Oct 09 '23 14:10 owenpearson