Page 1 of 1

Error when exceeding maxUsers in a room

Posted: 19 Apr 2010, 04:55
by atarim
Steps to reconstruct the error:
1. set maxUsers property in the Room tag in config.xml to 2;
2. Enter with 2 users to the room - still OK.
3. When entering with the third user, the following error arise.

Error trace:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.smartfoxserver.openspace::OpenSpace/onMapRendered()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.smartfoxserver.openspace.mvc::IsoEngineModel/onMapBuilt()
at com.smartfoxserver.openspace.map::MapManager/onMapGenerationCompleted()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.smartfoxserver.openspace.utils.executor::MultiFrameExecutor/runStep()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()

This error is in one of the openspace core classes, not mine, so I've got nothing to fix.
It doesn't matter which browser I'm using or the value I set in maxUsers property. It always act the same on the (maxUsers+1) user.

What is the default behaviour when exceeding that number. Shouldn't a new room be oppened?

Posted: 19 Apr 2010, 07:24
by Bax
What is the default behaviour when exceeding that number. Shouldn't a new room be oppened?

Actually no. OpenSpace v1 is not in charge of the room join process, which is up to you. In this case, you probably don't handle the "join room error" that the SmartFoxClient instance fires, and tell OpenSpace to load the map anyway. This is a wrong approach: you must load the map only after the corresponding SFS room has been joined successfully.

Posted: 19 Apr 2010, 07:34
by atarim
Thanks bax,

I do load the map only after joining the room, but as you mentioned - I didn't treat the join room error event to notice that this was the reason for the failure.

Isn't there a solution for a lobby room that opens new room automatically when a room is full? should it be done manually by checking the condition of the current room?

Posted: 19 Apr 2010, 09:06
by Bax
Isn't there a solution for a lobby room that opens new room automatically when a room is full? should it be done manually by checking the condition of the current room?

You should do this in your server-side extension, by catching the room join request and applying you own logic to spawn new rooms if needed.