javascript - ReactJs Stop someone loading a page if someone is already inside of it -


i writing system multiple people logged @ time can't have 2 users looking @ same user record @ same time. how make 2 people cant looking @ same data. if username: admin looking @ record: 123, , username: user wants access record: 123 user given prompt saying "sorry admin looking @ record please wait until have finished thank you"

how go locking other user out.

so search record in left box , click search brings results pane on right results. want when click open takes record if theres in record want wrote above.

enter image description here

there no simple way of achieving this, , cannot client side browser unaware of happening on other browsers.

you have implement on server side socket.io.

with socket can issue websocket push logged in users when user goes record.

  1. for instance example lets user admin goes record 123.
  2. then can send notification other logged in users , tell them user admin looking @ record 123.
  3. on client side ( presuming using redux store ) can update records , make 123 unreadable or not displayable.

*there need keep in mind though, when user navigates out of screen need unlock record. problem users can leave page doing multiple actions ( pressing browser button, closing page, or navigating other page on application ). need way figure out, once have done can update users notification saying record available , repeat steps above.

hope explains enough, tell me if need more clarification.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -