skip to Main Content

Currently, our system is keeping the tab open on customers’ computers for a long time and this has become a problem. When we upload updates to production, this client needs to press F5 to receive the updates. However, as he doesn’t log out, he doesn’t get updates and reports problems that no longer exist.

How can I solve this problem? I need some way that when production receives updates, these clients have their tab cache reset or other options.

Note: I use NextJs and I am hosting my system on IBM Cloud.

I haven’t tried anything concrete yet, I thought about uploading a json with a version inside, which will compare the current version with the production version and somehow, when it’s different, clear the client’s browser cache so they can receive the update.

2

Answers


  1. You could have an action register frontend deployments with the backend. The frontend can then poll the backend to check if the build differs from the already stored one. I like polling the backend rather than your infrastructure.

    You could force a refresh in that case or warn the user. In either case, your state management should persist any unsaved changes before a refresh to account for user error.

    Edit: Use websockets or events to check realtime

    Login or Signup to reply.
  2. Instead of using WebSockets, server sent events (SSE) fits better in your use case, once it is unidirectional and the client won’t need to send data to the server.

    Whenever the server gets updated, it should message clients through SSE, so it can be handled by it by refreshing, changing states or whatever.

    The downside is that your server may have an increase in the memory once it will have to keep new TCP connections open for each SSE client.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search