We are creating a video chat web app that is using Tokbox (PHP/JS).
We will have the same 5 "rooms" (sessions) all the time. A user can join one of the 5 rooms where a moderator will be conducting the chat.
We have gone through the hello world demos and made some various test apps and all seems to be working as we need it.
However, my question lies in managing the sessions/ids for our 5 chat rooms.
Is it (A) necessary to create unique session ids dynamically with the server PHP code? Or, since we are only going to have 5 rooms, can we (B) generate the session ids in our account control panel and hard code the session ids for the five rooms into the client side?
Option B, seems pretty straightforward.
Option A, I am thinking we would have to build an interface for the moderators to choose a room and then generate the room's session id when the moderator "activates" the room for users to then join.
Does anybody have any best practices on how to manage Tokbox session ids when you are using the same sessions over and over?
Thank you!
Adam here from the OpenTok team.
It should be fine to just generate the sessionIds once and reuse them (option B). You are not going to be able to hard-code the tokens though, you will still need to generate those with a server-side SDK in your app server. This is because the tokens expire, by default after 24 hours but you can configure that time. You generally want to generate a new token for every user each time they want to connect to a session.