Two way call sunscriber gets duplicated if rejoining session

I’ve come across another problem.

So if there is a 2 way session and the subscriber ( not the original publisher) closes the browser and then comes back to re-join the session with a new token, the video stream gets duplicated on the screen and the original freezes

So what my code does is, when the user comes to join the publisher for a two way call the system contacts vidu and asks for a token to join the session it then uses that token to join.

Now when the tab is closed or they leave the page I have code to force the connection to the session to be closed but if the browser crashes or is forced closed and the come back, a new token is generated and it then duplicates the stream.

It’s like vidu in the background isn’t detecting that the subscriber has left, so mt questions

  1. is it something to do with the garbage collection timeout as to why the server doesn’t pick up that the user left the session and force closes it? Would it work if I changed it from 15 mins to say 10 seconds? Or is that going to cause more problems? I can’t have it messing up like this

  2. would it work if the same token was reused when the subscriber comes back instead of generating a new one? If so, how would I check with vidu if the original token is still valid or not?

When I say it duplicated, what I mean is, when the subscriber comes in and connects they can view the original publisher, then the subscriber publishes their side to do a two way call. A few seconds later the original video that was subscribed to from the original publisher freezes and a new video element gets added