communication between extensions problem

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

Moderators: Lapo, Bax

User avatar
levancho
Posts: 71
Joined: 27 Jun 2011, 16:03

communication between extensions problem

Postby levancho » 07 Nov 2012, 14:58

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.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: communication between extensions problem

Postby rjgtav » 07 Nov 2012, 20:57

Hi,

The SFSExtension already extends the BaseSFSExtension class, which means that you have access to the handleInternalMessage() method from your extension.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: DerikFent, JerodSa, Keganniff, LesAttara and 33 guests