简体   繁体   English

TokBox / OpenTok Web RTC-限制订户数

[英]TokBox/OpenTok Web RTC - Limiting number of subscribers

Using the TokBox/OpenTok Javascript API - Is there any way to limit the numbers of subscribers to a stream? 使用TokBox / OpenTok Javascript API-是否有任何方法可以限制流中订阅者的数量? Ie To only allow a single subscriber to a published stream and redirect any other subsequent would-be subscribers. 即仅允许单个订阅者访问已发布的流,并重定向其他任何后续的可能订阅者。

There isn't an explicit way to do this in the OpenTok API but I can think of a couple of ways you could do it. OpenTok API中没有明确的方法可以执行此操作,但我可以想到几种方法。

  1. You could only have 1 stream per session and that way you can only give out 1 token that is allowed to connect to that session and subscribe. 每个会话只能有1个流,这样一来,您只能发出1个令牌,该令牌可以连接到该会话并进行订阅。

  2. You could use the signaling API to send a message to the participant that is allowed to subscribe. 您可以使用信令API将消息发送给允许订阅的参与者。 So for example your application logic could be that a participant sends a signal to the publisher requesting that they can subscribe to the stream and if they receive a response back then they go ahead and subscribe. 因此,例如,您的应用程序逻辑可能是参与者向发布者发送信号,要求他们可以订阅该流,如果他们收到响应,则继续订阅。 Then on the publisher side you can make sure you only send out one response. 然后,在发布方,您可以确保只发送一个回复。

I hope you find that helpful. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM