Cache channel list and messages data on web (Next, React) and desktop applications (Electron) like Get Stream React Native and Flutter mobile app caching feature
Motivation I am working on a caching feature with the Get-Stream React/Next and Electron project. The app is built with Next with typescript and bundled with Electron. The final product will be a desktop and web app. I want to cache the channel list data, and their messages data and save them to some sort of local storage. (In my opinion web local storage would be too small)
Even though I want to use one solution for both of the platforms I mentioned, I am guessing that it would be futile since the platforms are so different.
(Our team's developers tried to cache the channel's data to the web's local storage and failed. )
The company I am currently working on has already made a mobile app with Flutter and Get-Stream. The Get-Stream Flutter and React-Native SDK have a caching feature that stores channel list data and messages. But the React SDK doesn't. I am hoping that the Get-Stream team could help me by creating a caching feature like the mobile SDK's.
Proposed solution I want the Get-Stream team to implement a feature that caches all the necessary data in a web or desktop app. I don't have a particular solution yet, but I think it's possible to do it with local storage.
Acceptance Criteria The caching solution should work on both React and Electron (web and web-based desktop apps). The solution should be integrated with the SDK's. If it's not possible at the moment (or I am wrong), please suggest a different method or a way to implement the feature. Thanks in advance.
Hello @Gantushig97 , thank you for the suggestion. We will keep it in our backlog for now as we do not plan to introduce cache support for the React SDK in the near future.
In that case, I would like to develop a custom caching feature for my app. Do you have any recommendations or ideas on how to do that? I tried to do it with Redis but could not pass the cached data to the SDK.
Hello @Gantushig97 you can set channels and active channel state. This API is accessible from the the ChatContext:
const { channel, channels, setActiveChannel, setChannels } = useChatContext();
But again, the SDK is not ready to support changing all the state it maintains. So even though you keep the data in some local storage, you may not be able to set it always. This will be your experiment, because the SDK does not claim to support what you are aiming at.
any updates on this?
+1