# Can we delete room and unpublish all videos publishing under this room from server

**URL:** https://discourse.lynckia.com/t/can-we-delete-room-and-unpublish-all-videos-publishing-under-this-room-from-server/52
**Category:** Uncategorized
**Created:** [January 13, 2015, 12:15pm UTC](https://discourse.lynckia.com/t/can-we-delete-room-and-unpublish-all-videos-publishing-under-this-room-from-server/52 "2015-01-13T12:15:49Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![atul\_tiwari](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@atul\_tiwari](https://discourse.lynckia.com/u/atul_tiwari)
#### Post date: [January 13, 2015, 12:15pm UTC](https://discourse.lynckia.com/t/can-we-delete-room-and-unpublish-all-videos-publishing-under-this-room-from-server/52/1 "2015-01-13T12:15:49Z")

</div>

Hi

I am working on a licode video conference application i would like to end  
conference through a service requests.  
I was thinking that if i will delete a room automatically streamed video’s  
got unpublished but it will not able to delete room when there is any user,  
while if there is no user same service will able to delete the room easily.

my code is following please suggest.

app.post(’/deleteRooms/’, function (req, res) {  
var confId = req.body.confId;  
console.log("CONFID = "+confId);  
N.API.getRooms(function (roomlist) {  
var rooms = JSON.parse(roomlist);  
var numRooms = rooms.length;  
console.log("Total Room = "+rooms.length);// check and see if one of these  
rooms is 'myRoom’  
for(var i in rooms){  
console.log('Room ', i, ‘:’, rooms[i].name);  
if(numRooms\>0 && (rooms[i].name === ‘conf-’+confId)){  
N.API.deleteRoom(rooms[i].\_id, function(result) {  
console.log('Result: ', result);  
result = 1;  
numRooms–;  
res.send(numRooms);  
});  
}else{  
res.send(rooms[i].name);  
}  
}  
});  
});

Thanks  
Atul

---

<div class="post-metadata">

### Author: ![Alvaro\_Alonso](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.lynckia.com/alvaro_alonso/32/32_2.png) [@Alvaro\_Alonso](https://discourse.lynckia.com/u/Alvaro_Alonso)
#### Post date: [January 30, 2015, 7:41am UTC](https://discourse.lynckia.com/t/can-we-delete-room-and-unpublish-all-videos-publishing-under-this-room-from-server/52/2 "2015-01-30T07:41:06Z")

</div>

Hi,

when you call NuveAPI deleteRoom method, nuve asks erizoController to  
delete that room and erizoController removes all the connections  
(publishers and subscribers) in the room. If there is no users connected in  
the room, it doesn’t exist in erizoController so it will only be removed in  
nuve.

BR2015-01-13 13:15 GMT+01:00 atul tiwari [atulmca.13@gmail.com](mailto:atulmca.13@gmail.com):

> Hi
> 
> I am working on a licode video conference application i would like to end  
> conference through a service requests.  
> I was thinking that if i will delete a room automatically streamed video’s  
> got unpublished but it will not able to delete room when there is any user,  
> while if there is no user same service will able to delete the room  
> easily.
> 
> my code is following please suggest.
> 
> app.post(‘/deleteRooms/’, function (req, res) {  
> var confId = req.body.confId;  
> console.log("CONFID = "+confId);  
> N.API.getRooms(function (roomlist) {  
> var rooms = JSON.parse(roomlist);  
> var numRooms = rooms.length;  
> console.log("Total Room = "+rooms.length);// check and see if one of these  
> rooms is ‘myRoom’  
> for(var i in rooms){  
> console.log('Room ', i, ‘:’, rooms[i].name);  
> if(numRooms\>0 && (rooms[i].name === ‘conf-’+confId)){  
> N.API.deleteRoom(rooms[i].\_id, function(result) {  
> console.log('Result: ', result);  
> result = 1;  
> numRooms–;  
> res.send(numRooms);  
> });  
> }else{  
> res.send(rooms[i].name);  
> }  
> }  
> });  
> });
> 
> Thanks  
> Atul
> 
> –  
> You received this message because you are subscribed to the Google Groups  
> “lynckia” group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [lynckia+unsubscribe@googlegroups.com](mailto:lynckia+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
