[英]Is there a way to subscribe to a room's `participantConnected` event without becoming a participant?
One can use the room
returned from calling Video.connect
to subscribe to a room's participantConnected
event, so that all kinds of different logic can be executed when a new participant joins a room.可以使用调用
Video.connect
返回的room
来订阅房间的participantConnected
事件,以便在新参与者加入房间时执行各种不同的逻辑。 I can also query rooms remotely without Video.connect
to see how many participants are currently connected.我还可以在没有
Video.connect
的情况下远程查询房间,以查看当前连接了多少参与者。 However, I would like be able to use the participantConnected
event to display in real time if someone is in a room, without actually joining the room.但是,我希望能够使用
participantConnected
事件实时显示某人是否在房间内,而无需实际加入房间。
Is this possible and how would I do that without becoming a participant via Video.connect
and without polling twilio's api?这可能吗?如果不通过
Video.connect
成为参与者并且不轮询 twilio 的 api,我将如何做到这一点?
Preferably, I'd like to do this on the javascript side, but I could use twilio's api wrapper library on the server-side if I had to.最好,我想在 javascript 端执行此操作,但如果必须的话,我可以在服务器端使用 twilio 的 api 包装器库。 I just want the client to get notified somehow when someone enters or leaves a room so I can display whether the room is empty in real time.
我只是想让客户在有人进入或离开房间时以某种方式得到通知,这样我就可以实时显示房间是否为空。
In order to receive those events with the client SDK, you would need to join the room as you would need a connection to it in order to receive events from it.为了通过客户端 SDK 接收这些事件,您需要加入房间,因为您需要连接到它才能接收来自它的事件。
You can, however, subscribe to status callback webhooks for rooms .但是,您可以订阅房间的状态回调网络钩子。 There are lots of events that a room emits that can be received as webhooks, such as
room-created
, room-ended
, and, as you've asked for, participant-connected
.房间发出的许多事件都可以作为 webhook 接收,例如
room-created
、 room-ended
以及您要求的participant-connected
。
You can set the statusCallback
when you create a room with the REST API and you can see all the parameters that are sent as part of the webhook request here .您可以在使用 REST API 创建房间时设置 statusCallback
statusCallback
您可以在此处看到作为 webhook 请求的一部分发送的所有参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.