Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Receive last message and history #90

Open
mandymozart opened this issue Oct 7, 2023 · 2 comments
Open

Receive last message and history #90

mandymozart opened this issue Oct 7, 2023 · 2 comments

Comments

@mandymozart
Copy link

mandymozart commented Oct 7, 2023

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

@sync-by-unito
Copy link

sync-by-unito bot commented Oct 7, 2023

➤ Automation for Jira commented:

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

@owenpearson
Copy link
Contributor

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 🙂

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants