Page 1 of 1

communication between extensions problem

Posted: 07 Nov 2012, 14:58
by levancho
Hi,
I have encountered this problem and I am kind of puzzled how to solve it, its related to class Loader know issue that gives following erros when I try to get extension from other extension example:

Code: Select all

            Room room = getParentExtension().getParentZone().getRoomById(roomId);
           AGiviGameBaseExtension ext = (AGiviGameBaseExtension)room.getExtension()


this causes following error:
Message: com.zcolegia.givi.sf2.exts.games.G_BeirutExtension cannot be cast to com.zcolegia.givi.sf2.exts.base.AGiviGameBaseExtension


I have seen solutions suggesting to use handleInternalMessage of BaseSFSExtension, now If I go to that rout, i have a question:

why is this method nto implemented on newer SFSExtension plus smartfox doc says that usage of BaseSFSExtension is not recommended so is there some kind of additional overhead for me to change SFSExtension and use SFSExtension, do I have to do some additional manual management, of the code, since it talks about init, destroy and some other older methods,

and is there any performance difference using BaseSFSExtension over SFSExtension,

and finally, is there another way to communicate between extensions,besides this ?
maybe i can dispatch a command from one extension on serverside and let other exstension listen for it and send response back, is it possible?
some kind of internal command structure?


let me clarify why i need tis our architecture is following:

zone has its own extension, lobby its own and each game type has its own,
we need to get some info from the games using its extension for example if there are users waiting to join the room (they are placed in waiting list) this information is store in extension, maybe we should move them as room variables and then we do not need extension to access them?
is there this kind of practise? is it ancouragable to use room variables for that purpose?


what are possible suggestions?

kind regards
Levancho.

Re: communication between extensions problem

Posted: 07 Nov 2012, 20:57
by rjgtav
Hi,

The SFSExtension already extends the BaseSFSExtension class, which means that you have access to the handleInternalMessage() method from your extension.