B
B
babai192015-04-03 14:43:40
JavaScript
babai19, 2015-04-03 14:43:40

How to determine that there is a logged-in user on a particular page?

There is an application on node.js + angular.js, I’m interested in how you can implement the following:
if someone logged in and went to a certain page in their personal account, then logging in under another user could not go to the same page? That is, it is necessary to somehow track that another user is on this page, but how?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2015-04-03
@xmoonlight

via database
link: user -> last page

T
Timur Shemsedinov, 2015-04-03
@MarcusAurelius

It is necessary to determine that the user has not just entered, but is sitting on this page, has not closed it and has not turned off the computer. To do this, you need to open a websocket to the server and periodically (5-10 seconds) send a piece of data (heartbeat) over it. And on the server you need to keep a table of correspondences, who "holds" which page. Take the https://www.npmjs.com/package/websocket library and implement it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question