Sync ServerCache and ClientCache
Unanswered
Persian posted this in #help-forum
PersianOP
Is there a good way to have a synced cache between next-client and next-server files?
I am trying to find something valid to go after, but it all seems to outdated information.
I am trying to find something valid to go after, but it all seems to outdated information.
9 Replies
Longtail tuna
i'd say websockets, but since nextjs doesnt support them (still) you can use streams/sse
you can try https://www.npmjs.com/package/@upstash/realtime to emit cache stuff to client immediately
still you'd need to write cache logic
@Longtail tuna i'd say websockets, but since nextjs doesnt support them (still) you can use streams/sse
Sun bear
next.js does support websockets
the way you are deploying your application probably does not
@Sun bear next.js does support websockets
Longtail tuna
sure it does if you are up to setup
custom server and lose most of nextjs featuresSun bear
and what are those next.js features that you lose :D
Longtail tuna
as per docs
PersianOP
I have sat up a SSE system.
My idea was to set up a caching system and using SSE to update the cache in client.
I don´t want to build something that make the client able to send to server cachce (never trust the client)..
Would you say I am on the right path?
My idea was to set up a caching system and using SSE to update the cache in client.
I don´t want to build something that make the client able to send to server cachce (never trust the client)..
Would you say I am on the right path?