Close room properly (prosody custom module)

meet

#1

Hello,

I created a Prosody custom module that closes conference after a participant with specific JWT leaves the room. But I want to fire other participants first before destroying the room.

module:hook("muc-occupant-left", function(event)
if shouldWeCloseRoom(event.origin.auth_token) then
  --FIRE OTHER PARTICIPANTS FIRST
  ...
  --Destroy Room
  event.room:destroy();
end
end,150)

Any ideas guys ?
Many thanks


#2

Hello,

I found this

module:hook("muc-occupant-left", function(event)
if shouldWeCloseRoom(event.origin.auth_token) then
  --FIRE OTHER PARTICIPANTS FIRST
  event.room:clear();
  --Destroy Room
  event.room:destroy();
end
end,150)

However, does anyone have an idea on how to handle conference.destroyed event on the browser side ?
This is what the client gets when event.room:destroy() is executed by prosody :

I’d like to add a listener on conference.destroyed event in order to redirect client to the home page once this event is triggered…


#3

You can handle it here: https://github.com/jitsi/jitsi-meet/blob/b7b43e8d9c582910aa043a522fbe1b19500c2b44/conference.js#L415


#4

It works like a charm. Thank you.

Here’s the full code if someone needs this in the future :

APP.conference.addConferenceListener("conference.failed",function (e){
    switch(e) {
        case "conference.destroyed":
            document.location.href="/";
            break;
        default:
            console.error(e)
    }
});