DEV Community

Discussion on: Device Limit like netflix

Collapse
 
afrazs profile image
afrazs

Nick,

Thanks a lot for the reply.

I want to limit number of devices per user. Its not about streaming but its a simple MEAN stack application and we need to limit users' devices. Like 1 user can login to only 2 devices otherwise, we won't let them login.

Please let me know what suggestions you have or reply me for any questions further if above doesn't fulfill the requirement.

Thanks

Collapse
 
nickholmesde profile image
Nick Holmes

Right. So you have a couple of problems to solve. Firstly you need to be able to uniquely identify every device. This is not so easy, but there is an interesting and detailed paper on some approaches.

The next thing to solve is understanding when a user is (still) using a device. As HTTP is stateless, it can be hard to know if the user is still using your app or not. Unless you already have some notion of session, or a proxy for it, you will need to keep recording the last time you see any activity from the user, and then assume they are no longer using the device after, for example 30 minutes.

Then really is just a matter of putting these things together, and checking how many sessions are currently running of each users, when they authenticate.