Playback structure: how to control the number of active sessions with a standard session API?

The Play platform has an API for creating a session, adding some data to a session, and canceling a session. But I would also like to get some idea of โ€‹โ€‹such things as the number of active sessions in my installation, the amount of data in volume associated with them, etc. Are there any means to solve this problem?

+6
source share
1 answer

Playback is carried out on the basis of the โ€œstatelessnessโ€ principle by nature, therefore it is not monitored and not monitored on the server. When you use the session API, you simply create a cookie that will be sent with each request / response from / in the browser.

This cookie does not have a timeout or expiration date, so it will remain until the browser is open. However, you can implement your own session timeout mechanism by setting the last access time in the session cookie and compare it with the desired timeout for each request.

+5
source

Source: https://habr.com/ru/post/984080/


All Articles