The session limit can be imposed through the Metadata Adapter as well.
Indeed, if the limit is a strict one and is not simply a protection limit, then the Metadata Adapter is the module that should be responsible for it.
The
notifyNewSessionand
notifySessionClose methods provide you with the ability of counting the sessions and blocking some of them.
Consider that a strict control of the number of sessions is complicated by several factors.
As you limit yourself to a single Server instance, this simplifies things significantly.
However, there is no strict correspondance between sessions in the Server and instances of your application running on the browser, because
- The life of a session in the Server can continue for some seconds after the client has closed or reloaded the application.
- In case the Stream-sense mechanism comes into action, two sessions can be temporarily started before one is assigned to the application.
Hence, you won't exceed 1000 sessions on the Server, but the real sessions may be a few less.
Can you cope with this?