I'm getting "OpenViduHttpException" 404 error

I’m running the js-java tutorial and it works fine. My app is very much based on this example so getting the error must mean that i do something wrong. However i can’t find what causes this exception.
Here is the case: At first i create a new session. Then i log in and i see the video on screen. I leave the session by clicking the button and then the session.disconnect() is called on the frontend. Now, if i try to enter the same session again i get this exception thrown from this line on the backend:
String sessionToken = session.createConnection(connectionProperties).getToken();

It could be something very foolish. I’ll update this post if i find it myself. In the meantime it would be helpful to give me any suggestions on where to look at to solve the problem

EDIT: Is by any chance the session destroyed when the publisher disconnects or when the last user disconnects?

Yes. Sessions are automatically removed when all users are gone.

To avoid any issue you can try to recreate the session always before you want to get a new token. If the session is already created, just ignore the error. If the session is not in the server (because it is removed), then it will be created again.

Now i’m having more questions that i can’t answer.

  1. How am i supposed to set the maximum connected users per session?
    However this leads to another problem. Say for example that you have 20 max. connections session that is full with 19 subscribers or publisher and 1 moderator. Suppose the moderator leaves the session for a while and while he is away another subscriber connects. Now there would be no chance for a moderator to log in, which is really bad.

  2. I’m using the session name as a session id. I keep the connected users in a Map(session name, token). If this Map is empty then the session name is available. If the map is non-empty then a session is supposed to be running.
    However, on the client side, a user can leave a session without sending a /remove-user request in order to update the map (for example when a user’s pc closes because of low battery). In this case, the openvidu server removes the user but the backend-spring boot server does not. So, the session name will never be available again. It will always look like the session is being used.

Please open new entries en the forum so it is more easy for others to help you. Also, the topics are more “discoverable” for other looking for solutions.

Hi again.
I just wanted to ask if its possible to configure openvidu server so as to keep sessions alive even when the last user leaves the session.