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!
答案 0 :(得分:1)
OpenTok团队的亚当。
最好只生成一次sessionIds并重用它们(选项B)。但是,您将无法对令牌进行硬编码,仍然需要在应用程序服务器中使用服务器端SDK生成令牌。这是因为令牌默认在24小时后过期,但是您可以配置该时间。通常,您希望每个用户每次要连接到会话时都为其生成一个新令牌。