If I send the response as JSON the extension handler on the client-side does not get fired, but if I send it as ActionScriptObject everything works fine.
Here is the code that works on the server-side:
Code: Select all
ActionscriptObject response = new ActionscriptObject();
response.put("_cmd", CustomCommand.BUDDY_MESSAGE); //"buddyMessage"
response.put("buddyName", buddyName);
response.put("msg", buddyMessage);
LinkedList<SocketChannel> recipients = new LinkedList<SocketChannel>();
recipients.add(user.getChannel());
_parentExtension.sendResponse(response, user.getRoom(), user, recipients);
And here is the code that does not work:
Code: Select all
JSONObject response = new JSONObject ();
response.put("_cmd", CustomCommand.BUDDY_MESSAGE); //"buddyMessage"
response.put("buddyName", buddyName);
response.put("msg", buddyMessage);
LinkedList<SocketChannel> recipients = new LinkedList<SocketChannel>();
recipients.add(user.getChannel());
_parentExtension.sendResponse(response, user.getRoom(), user, recipients);
As you can see the only difference is the response type (one is ActionScriptObject, and the other one is JSONObject).
Both responses get to the client (I see the SmartFoxDebug debug "INFO [ RECEIVED ]: " message on my console), but the ExtensionHanlder only gets the xml-based response (the one that uses ActionScriptObject on the server), but not the json-based one.
I'm using Java for both server and client code.
Any clues?