Home > Software engineering >  Redirect all users when the admin clicks start button
Redirect all users when the admin clicks start button

Time:07-28

So I am working on a voting application. The application have an admin and users.

I want the voting campaign to start when the admin clicks on start button.

I want to redirect all users to another page when the admin start the voting.

Any suggestions ? How can I implement this without sending a request to the database.

Technologies used : Angular and Java (spring boot), mysql DB

( Edit : my app is like poker planning (scrum planning) websites, for example : **https://www.planningpoker.com/ )

CodePudding user response:

You haven't provided any code for us to solve a coding issue, but in theory if you were using JWT and you set a token expiry of say 5 seconds, then your app would have to re-authenticate the token every 5 seconds. You could include logic/code in the token refresh to test if the a vote was required, if it was redirect user to this page.

You cannot do this without sending a request to the DB, as each client is agnostic of another client, so using a global service will only store data in the clients browser.

So:

  1. Admin, sets "vote" triggers a change in back end DB
  2. JWT login token is refreshed every 5/10seconds (or whatever)
  3. as part of refresh cycle, test to see if database has a vote value
  4. if true, re-direct user to vote page.
  • Related