Hi,
OpenVidu automatically closes a session after last participant connected to it leaves the session.
So: you create a session using API REST (POST /api/sessions). That session is ready to produce tokens (POST /api/tokens), that then can be used by users to connect to it. After first user connects to it with a token, we can say that the session is “active”. More users can connect to it, recordings can be started…
Consulting sessions with API REST (GET /api/sessions) will return all created sessions (sessions with no connected users yet, and “active” sessions with connected users).
After last of the users leaves (that is, the number of users connected goes from >=1 to 0), the session is automatically closed. Except if it is currently being recorded. If so, a countdown of 2 minutes starts, and if it ellapses without new users connecting to it, the recording is stopped and the session if finally closed (the countdown time can be configrued with a global parameter. You can learn more about this here.
If this post is related to this one, OpenVidu 2.11.0 and below has a known bug that may cause some sessions to enter a “ghost” state in which the are not eliminated once last user disconnects. This has been addressed for release 2.12.0 (coming very soon) and luckly it will be solved.
That being said, if you have any information on how to actively reproduce the error in 2.11.0, it would be very useful to check that it doesn’t happen anymore in the current dev branch.
Best regards!