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.
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.
- for instance example lets user admin goes record 123.
- then can send notification other logged in users , tell them user admin looking @ record 123.
- 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
Post a Comment