dmitry027 Posted December 1, 2022 Share Posted December 1, 2022 (edited) Hello, everybody. The behavior of Ant Media when I am trying to create conference room having the same roomId multiple times via REST API is not entirely clear for me. Steps to reproduce: 1. Open two tabs of the browser with conference demo https://localhost:5443/LiveApp/conference.html 2. Create conference room via REST API: curl -X 'POST' 'https://localhost:5443/LiveApp/rest/v2/broadcasts/conference-rooms' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{ "roomId": "test_room" }' 3. Join the room "test_room" in browser tab #1 4. Repeat create request: curl -X 'POST' 'https://localhost:5443/LiveApp/rest/v2/broadcasts/conference-rooms' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{ "roomId": "test_room" }' 5. Join the room "test_room" in the browser tab #2 What I expect to see: I see two videos (local and remote) in browser tab #1 and two videos (local and remote) in browser tab #2 What I actually see: I see two videos (local and remote) in browser tab #1 and only one video (local) in browser tab #2. Is this behavior the expected one? Edited December 1, 2022 by dmitry027 Fix format, add tags Link to comment Share on other sites More sharing options...
0 Yash Posted December 2, 2022 Share Posted December 2, 2022 Hi @dmitry027 I hope you are doing well. After creating the room using Rest API before joining, you do not have to create the same room again for 2nd user. N no of viewers can join the same room. When you are creating the same room again, it is overwrites the details of previous room. Link to comment Share on other sites More sharing options...
0 dmitry027 Posted December 4, 2022 Author Share Posted December 4, 2022 On 12/2/2022 at 2:40 PM, Yash said: Hi @dmitry027 I hope you are doing well. After creating the room using Rest API before joining, you do not have to create the same room again for 2nd user. N no of viewers can join the same room. When you are creating the same room again, it is overwrites the details of previous room. Hello, @Yash. Thanks for you answer. Yes, I understand that there is no need to create same room again for each user. My motivation is the following: when the first user joins the room, I want to be sure that the room that he is trying to join exists. So I make create call for each user joining the room, because I don't know if the room already exists or not. The alternative way I see is to check the room existence by calling GET request and create the room only if I got 404 error. But I'm afraid in rare cases it can lead to the same situation because of concurrency (because room existence check and creation is not atomic): 1. User1 and User2 are trying to join the same room at the same time. 2. Both of my application workers check room existence (by calling 'GET /v2/broadcasts/conference-rooms/{room_id}') and got 404. 3. Both are trying to create the room. 4. The next steps for each worker is to create user stream (by calling 'POST /v2/broadcasts/create'). 5. And associate it with the room (by calling PUT /v2/broadcasts/conference-rooms/{room_id}/add). If worker-1 hangs between steps 2 and 3 (for some reason) while worker-2 reaches step 5, the worker-1 will rewrite the room created by the worker-2 when it will reach step 3 and first stream would be missing. What do you think? Link to comment Share on other sites More sharing options...
Question
dmitry027
Hello, everybody.
The behavior of Ant Media when I am trying to create conference room having the same roomId multiple times via REST API is not entirely clear for me.
Steps to reproduce:
1. Open two tabs of the browser with conference demo https://localhost:5443/LiveApp/conference.html
2. Create conference room via REST API:
3. Join the room "test_room" in browser tab #1
4. Repeat create request:
5. Join the room "test_room" in the browser tab #2
What I expect to see:
I see two videos (local and remote) in browser tab #1 and two videos (local and remote) in browser tab #2
What I actually see:
I see two videos (local and remote) in browser tab #1 and only one video (local) in browser tab #2.
Is this behavior the expected one?
Edited by dmitry027Fix format, add tags
Link to comment
Share on other sites
Top Posters For This Question
2
1
Popular Days
Dec 1
1
Dec 2
1
Dec 4
1
Top Posters For This Question
dmitry027 2 posts
Yash 1 post
Popular Days
Dec 1 2022
1 post
Dec 2 2022
1 post
Dec 4 2022
1 post
2 answers to this question
Recommended Posts