SendXtMessage problem
Posted: 04 Aug 2010, 07:46
I am using c# for my client.
my extension code is below
with string
it's right, handleRequest is invoked correctly
But xml and json type has problem
any handler is not invoked.
debug trace show like this
How should I use SendXtMessage with json or xml?
my extension code is below
Code: Select all
public void handleRequest(String cmd, JSONObject jso, User user, int fromRoom)
{
trace("handleRequest JSONObject " + cmd);
}
public void handleRequest(String cmd, ActionscriptObject asObj, User user, int fromRoom)
{
trace("handleRequest ActionscriptObject " + cmd);
}
public void handleRequest(String cmd, String[] data, User user, int fromRoom)
{
trace("handleRequest String " + cmd);
}
public void handleInternalEvent(InternalEventObject ieo)
{
trace("handleInternalEvent " + ieo.getEventName());
}Code: Select all
ArrayList arrayData = new ArrayList();
arrayData.Add(100);
arrayData.Add(200);
arrayData.Add(300);
arrayData.Add(400);
smartfox.SendXtMessage("ZoneMain", "LoginSecondStep", arrayData, SmartFoxClientAPI.SmartFoxClient.XTMSG_TYPE_STR);Code: Select all
[ ZoneMain ]: handleRequest String LoginSecondStepCode: Select all
Hashtable xmlData = new Hashtable();
xmlData["0"] = 100;
xmlData["1"] = 200;
xmlData["2"] = 300;
xmlData["3"] = 400;
smartfox.SendXtMessage("ZoneMain", "LoginSecondStep2", xmlData, SmartFoxClientAPI.SmartFoxClient.XTMSG_TYPE_XML);
Hashtable jsonData = new Hashtable();
jsonData["0"] = 100;
jsonData["1"] = 200;
jsonData["2"] = 300;
jsonData["3"] = 400;
smartfox.SendXtMessage("ZoneMain", "LoginSecondStep3", jsonData, SmartFoxClientAPI.SmartFoxClient.XTMSG_TYPE_JSON);debug trace show like this
Code: Select all
17:12:03.046 - [ INFO ] > { DATA IN } : <msg t='xt'><body action='xtReq' r='-1'><![CDAT
A[<dataObj><var n='cmd' t='s'>LoginSecondStep2</var><var n='name' t='s'>ZoneMain</var><
obj o='param' t='a'><var n='3' t='n'>400</var><var n='0' t='n'>100</var><var n='1' t='n
'>200</var><var n='2' t='n'>300</var></obj></dataObj>]]></body></msg>
17:12:03.065 - [ INFO ] > { DATA IN } : {"b":{"r":-1,"p":{"3":400,"0":100,"1":200,"2":3
00},"x":"ZoneMain","c":"LoginSecondStep3"},"t":"xt"}