Error when exceeding maxUsers in a room

Post here your questions about the OpenSpace 1.x or notify bugs and suggestions.

Moderators: Lapo, Bax

Post Reply
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Error when exceeding maxUsers in a room

Post 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?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post 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.
Paolo Bax
The SmartFoxServer Team
atarim
Posts: 26
Joined: 19 Apr 2010, 04:40

Post 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?
User avatar
Bax
Site Admin
Posts: 4626
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Post 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.
Paolo Bax
The SmartFoxServer Team
Post Reply