DEV Community

Discussion on: Device Limit like netflix

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.