handleRequest not getting called on SendXtMessage

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

smartApe
Posts: 13
Joined: 26 May 2012, 08:37

handleRequest not getting called on SendXtMessage

Postby smartApe » 26 May 2012, 09:07

hi this is my first post!

I'm i having issues getting my extenstion to run the following function

Code: Select all

public void handleRequest(String cmd, String[] params, User u, int fromRoom)
   {
      System.out.println("Handle request YES!!!");
      if(cmd == "SpawnObject")
         System.out.println("Spawn object recieved");   
   }


it will run the custom login in handleInternalEvent just fine, gets the room list, joins the game room, sends transform and chat data back and forth.



Code: Select all

SmartFoxClient client = SmartFox.Connection;
String[] d = {"Yes", "NO!"};
         
Debug.Log("Client info: " + client.activeRoomId);
client.SendXtMessage("rpgLogin", "SpawnObject", d, SmartFoxClient.XTMSG_TYPE_STR);
return;


i am running this on the client every 2.5 seconds as a spawn command but it is not going through. in my config i have

<SmartFoxConfig><ServerSetup><DebugIncomingMessages>true</DebugIncomingMessages>

and it is showing all other data being sent so i'm a little confused as to what is blocking my message. the extension name is correct (same value as extension view in admin tool)

it is in the same extension as my custom login handler, could that be an issue? im at the point of trying random things that probably arent helping, any insight would be highly appreciated.
smartApe
Posts: 13
Joined: 26 May 2012, 08:37

Re: handleRequest not getting called on SendXtMessage

Postby smartApe » 27 May 2012, 01:39

additionally, if i use

Code: Select all

 SmartFoxClient client = SmartFox.Connection;
         client.SendObject(data);


it sends the object (in console window verified) but the functionfor handling objects does not fire
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: handleRequest not getting called on SendXtMessage

Postby rjgtav » 27 May 2012, 22:17

Hello.
Hmm... Your code looks fine. Have you tried restarting the server to make sure you're running the latest extension's version?
And can you try using the JSONObject protocol instead?
Please make sure that you're running the latest server version alongside with the latest Client API.
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.
smartApe
Posts: 13
Joined: 26 May 2012, 08:37

Re: handleRequest not getting called on SendXtMessage

Postby smartApe » 28 May 2012, 23:41

rjgtav, thanks for your reply!

yes i've been restarting the server instead of reloading the extension every time. i attempted to send a json object but failed to recieved the message, the only thing the server gets in debug log thus far has been "SendObject".

here is my json code hopefully everything is right

on server:

Code: Select all

@Override
   public void handleRequest(String cmd,  org.json.JSONObject jso, User u, int fromRoom)
   {
      System.out.println("Received JSON object!");
   }


on client:

Code: Select all

SmartFoxClient client = SmartFox.Connection;
//client.SendObject(data);
         
String[] d = {"Yes", "NO!"};
client.SendXtMessage("mobControl", "SpawnObject", d, SmartFoxClient.XTMSG_TYPE_JSON);
return;


i just sent the string array because i wasnt too sure if the parameters affect if the function fires or not..

im using smartfox Pro 1.6.6. with jdk-6u31-windows-i586.exe and eclipse as my java IDE

so i was thinking it may have been because i had jdk7 installed, so i uninstalled all my java versions and just put the above release of java SE 6. im kind of new to java so could this possibly be a compiler setting? or something of that nature?

my next test is going to be a new project i suppose, maybe reinstall java and smartfox? could i be missing a lib / dll or whatever the java equivalent is?

*edit*
i also added a new class "mobControl" as the room extension, instead of trying to do this all in the zone extension for login.


*edit2*
also here i my server log, maybe something is missing from the chain of events that should be taking place before i can send/receive?

Code: Select all

|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|
|                                                            |
|              ...:::  SmartFoxServer :::...                 |
|                Multiplayer Socket Server                   |
|                      version 1.6.6                         |
|                           ---                              |
|              (c) 2004 - 2009 gotoAndPlay()                 |
|                  www.smartfoxserver.com                    |
|                    www.gotoandplay.it                      |
|                                                            |
|::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::|

::::::::::: { BlueBox INITED } ::::::::::::
:                                         :
: Version 1.0.5 -- (c) 2008 gotoAndPlay() :
:                                         :
:::::::::::::::::::::::::::::::::::::::::::
22:23:09.969 - [ INFO ] > Starting h2 engine...


--- [ System Info ] ------------------------------------------

System CPU(s): 4
VM Max memory: 517 MB

os.name: Windows Vista
os.arch: x86
os.version: 6.1
java.version: 1.6.0_13
java.vendor: Sun Microsystems Inc.
java.vendor.url: http://java.sun.com/
java.vm.specification.version: 1.0
java.vm.version: 11.3-b02
java.vm.vendor: Sun Microsystems Inc.
java.vm.name: Java HotSpot(TM) Server VM


--- [ Network Cards ] -----------------------------------------

Card:Software Loopback Interface 1
 -> 0:0:0:0:0:0:0:1
 -> 127.0.0.1
Card:WAN Miniport (SSTP)
Card:WAN Miniport (L2TP)
Card:WAN Miniport (PPTP)
Card:WAN Miniport (PPPOE)
Card:WAN Miniport (IPv6)
Card:WAN Miniport (Network Monitor)
Card:WAN Miniport (IP)
Card:RAS Async Adapter
Card:WAN Miniport (IKEv2)
Card:Realtek PCIe GBE Family Controller
 -> fe80:0:0:0:44a0:93d6:d66b:20f4%11
 -> 192.168.1.80
Card:Microsoft ISATAP Adapter
 -> fe80:0:0:0:0:5efe:c0a8:150%12
Card:Teredo Tunneling Pseudo-Interface
 -> 2001:0:4137:9e76:4b:12bc:b4ee:93c7
 -> fe80:0:0:0:4b:12bc:b4ee:93c7%13
Card:Realtek PCIe GBE Family Controller-QoS Packet Scheduler-0000
Card:Realtek PCIe GBE Family Controller-WFP LightWeight Filter-0000
Card:WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000
Card:WAN Miniport (IP)-QoS Packet Scheduler-0000
Card:WAN Miniport (IPv6)-QoS Packet Scheduler-0000


--- [ Licence Loaded ] ------------------------------------

License Type    -> PRO
License Owner   -> --== Free Demo Licence ==--
Max. Clients    -> 20
BlueBox Type    -> Demo Version

--- [ Zones & Rooms ] -------------------------------------

22:23:11.181 - [ INFO ] > Default Buddy List Persister <INITED>
22:23:11.182 - [ WARNING ] > Can't initialize BuddyListManager with passed list-
size of: 0
        DB Manager Activated ( org.gjt.mm.mysql.Driver )
Zone: theRPG

        MainRoom           (id: 1, max: 100, pass:N)
        TheRPG             (id: 2, max: 100, pass:N)
22:23:11.426 - [ INFO ] > Room Extension [ mobControl ] created!
  -- == --  MOBCONTROL ONLINE  -- == --
22:23:11.433 - [ INFO ] > Zone Extension [ rpgLogin ] created, for zone:theRPG



--- [ Server Starting ] ---------------------------------

Server address: All
Server port   : 9339

22:23:11.451 - [ INFO ] > [TaskScheduler] ... started ::
22:23:11.452 - [ INFO ] > [BlueBoxHandler]... started ::
22:23:11.453 - [ INFO ] > [EventWriter] ..... started :: 1 thread(s)
22:23:11.454 - [ INFO ] > [SystemHandler] ... started :: 1 thread(s)
22:23:11.454 - [ INFO ] > [ExtensionHandler]. started :: 1 thread(s)
22:23:11.455 - [ INFO ] > [DeadChannelsPolicy: strict]
22:23:11.456 - [ INFO ] > Server is up and running!
Handle internal request
22:23:26.695 - [ INFO ] > { DATA IN } : <msg t='sys'><body action='verChk' r='0'
><ver v='154' /></body></msg>
22:23:38.953 - [ INFO ] > { DATA IN } : <msg t='sys'><body action='login' r='0'>
<login z='theRPG'><nick><![CDATA[testDummy]]></nick><pword><![CDATA[testDummy]]>
</pword></login></body></msg>
Handle internal request
user: testDummy has connected.
sending room list to:
22:23:39.352 - [ INFO ] > { DATA IN } : <msg t='sys'><body action='joinRoom' r='
-1'><room id='2' pwd='' spec='0' leave='0' old='-1' /></body></msg>
MOBCONTROL - Internal Event Object
Handle internal request
22:24:11.443 - [ INFO ] > Disconneting idle user: testDummy
MOBCONTROL - Internal Event Object
Handle internal request



also i reinstalled java jdk-6u31 and smartfox pro 1.6.6, didnt help :\
smartApe
Posts: 13
Joined: 26 May 2012, 08:37

Re: handleRequest not getting called on SendXtMessage

Postby smartApe » 29 May 2012, 23:55

well dont worry about this thread anymore guys, i downloaded sfs2x, learned that API and its working now. 2x is so much nicer 8)

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 41 guests