ROOM_REMOVED is never fired

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

sadensmol
Posts: 25
Joined: 20 Feb 2018, 05:25

ROOM_REMOVED is never fired

Postby sadensmol » 14 Feb 2019, 11:19

Hello.
I have an event listener for ROOM_REMOVED event but when i remove the room from admin console this even isn't triggered.

I need the way to detect the room removal from admin console to refresh the rooms cache on the server.
Please help
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ROOM_REMOVED is never fired

Postby Lapo » 14 Feb 2019, 16:18

Hi,
the event is triggered for Extensions at Zone level, meaning the Extension attached to the Zone containing the Room.

You can't listen for that event at Room level though, which I suspect could be the problem.
If you need to detect when the Room is destroyed from within the Room Extension, make sure to implement the destroy() method in your Extension.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
sadensmol
Posts: 25
Joined: 20 Feb 2018, 05:25

Re: ROOM_REMOVED is never fired

Postby sadensmol » 15 Feb 2019, 05:42

Hi, Lapo.
Thanks for the answer.

I have extension attached to the zone.

Code: Select all

    protected void initHandlers() {
        addEventHandler(SFSEventType.USER_LOGIN, SlotsLoginHandler.class);
        addEventHandler(SFSEventType.USER_JOIN_ZONE, UserJoinZoneHandler.class);
        addEventHandler(SFSEventType.USER_JOIN_ROOM, SlotsUserJoinedRoomHandler.class);
        addEventHandler(SFSEventType.USER_DISCONNECT, SlotsUserDisconnectsOrLogoutHandler.class);
        addEventHandler(SFSEventType.USER_LOGOUT, SlotsUserDisconnectsOrLogoutHandler.class);
        addEventHandler(SFSEventType.USER_LEAVE_ROOM, UserLeaveRoomHandler.class);
        addEventHandler(SFSEventType.PUBLIC_MESSAGE, PublicMessageHandler.class);
        addEventHandler(SFSEventType.ROOM_REMOVED, RoomRemovedHandler.class);
    }


here is my room settings:

{5788A731-04F6-4C81-9CF8-0DA13365F868}.png.jpg
(36.62 KiB) Not downloaded yet


All other handlers are working well (login/join zone/ join room).

But when i delete the room from Admin Console I don't have RoomRemovedHandler working. Server doesn't execute it at all.
I suppose that maybe it's due to some room settings? Or Zone setting? When server just skips this event.
Any thoughts are welcome!

Thanks in advance.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ROOM_REMOVED is never fired

Postby Lapo » 15 Feb 2019, 09:44

If you take a look at the configuration screenshot you've sent you will notice that the Room is set as isDynamic=false and the Room Remove Mode is set to NEVER_REMOVE.

This means that unless you remove the Room from your code calling Zone.removeRoom(...) the Room will never be destroyed.

Keep in mind that all Rooms defined in the AdminTool are stored statically in the config and considered static Rooms, in other words they persist during the whole life cycle of the server, as opposed to dynamically created Rooms which are eventually removed.

For more on this, see the documentation here:
http://docs2x.smartfoxserver.com/Develo ... chitecture
Lapo

--

gotoAndPlay()

...addicted to flash games
sadensmol
Posts: 25
Joined: 20 Feb 2018, 05:25

Re: ROOM_REMOVED is never fired

Postby sadensmol » 18 Feb 2019, 12:38

Hi, Lapo.

Thanks for the answer.
Actually I don't want rooms to be dynamic and have any kind of auto removal option.
Im managing rooms by myself (some kind load balancing) - add new rooms from the code when needed, and remove when they aren't needed.
So in this case im okay that all rooms are static and have NEVER_REMOVE (automatically!) option.

We don't have any admin application in our project - so sometimes i need to remove rooms from SFS2x admin console (sometimes room logic freezes and we want just remove the room, handle this event and reconnect users to other rooms, and gracefully clean up the internal rooms cache for this room). I definitely say that Admin console removes the static rooms with NEVER_REMOVED setting just fine (so it destroys the room). Am i wrong on this?

is there any way to make rooms dynamic and NEVER_REMOVED and get Admin Console firing events during the manual rooms removal?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ROOM_REMOVED is never fired

Postby Lapo » 18 Feb 2019, 16:27

I see what you're saying.
I've investigated the removal from AdminTool and it looks like we're not triggering the event (the necessary flag is turned off), so at the moment it doesn't provide a notification.

We can change that in the next patch. If you need it quickly we can send you a pre-release, provided you're using SFS2X 2.13.x

Let me know.
Lapo

--

gotoAndPlay()

...addicted to flash games
sadensmol
Posts: 25
Joined: 20 Feb 2018, 05:25

Re: ROOM_REMOVED is never fired

Postby sadensmol » 19 Feb 2019, 07:03

Hi, Lapo.

This is great! If possible please just update this thread when new functionality will be added to the admin tool and new release version will be shipped. I will update server or admin tool.
I will monitor your blog new releases posts and also this thread when it's ready.

Thanks a lot!
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: ROOM_REMOVED is never fired

Postby Lapo » 19 Feb 2019, 07:52

Sure, I will post an update here.
Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 48 guests