Prevent Users from Joining Room Before Owner

I would like to prevent users from joining a room until an owner has joined. I thought about doing this with requestAccess() but the users already have full access to the room. With twilio , we did this by using a DataTrack to maintain some state but we don't have anything other than user metadata here. Is there a way to accomplish this or do we need to rework our UI flow a bit?

Answers

  • karl
    karl Dailynista

    Hi @aaron! Thanks so much for your question.

    Can you talk a little bit more about your use case, and what you're building with? You've tagged your post with daily-react; have you looked at useWaitingParticipants?

    In general, if you update a room's settings either in the Daily dashboard or via the REST API (say, making a room private and requiring knocking to enter), I believe even a previously public room should enforce those new restrictions on a user's subsequent visit (I was doing just this exact thing with a Daily room of my own the other day).

  • Hi @karl ,

    We're building live events with a single host (owner) and varying numbers of participants. This is currently just within our web app, using the react hooks library. Users are required to be signed in to access events and we use information from user accounts to generate tokens. From what I can tell from the docs and testing locally, knocking isn't going to work for us. requestAccess only works once you've already joined a meeting and it seems that you can't set accessLevel to lobby when generating a token.

    I guess we'll have to join meetings with startVideoOff and startAudioOff` and then turn them on once we know an owner is present.

  • Hi @aaron ,

    What you're describing is correct - when a meeting token is used to join a private room, that user is automatically granted access to the session, as the token acts as authentication for that user. In the absence of a token, knocking and the lobby functionality allow meeting owners to grant access to the session. This is an area of the API that we're hoping to improve in the future, so any feedback you have is appreciated!

    One possible alternative would be restrict generation of meeting tokens to owners only at the start. You can then use the /presence API or the "meeting join" webhook to detect when an owner joins a room, and enable meeting token generation for non-owner participants.

  • Hey @daily_joey ,

    One thing that would solve this, and potentially some other issues, would be adding metadata to a room object just like we have userData on participants. Calling preAuth() gives us access to the room using the useRoom() hook. So we could then watch for changes on roomData before calling join(). This would help a lot with room-level moderation and probably a lot of other use cases.

    For now, I think we're just going to have participants join the call with audio disabled and wait until an owner has joined before displaying video of other participants.