Code: Select all
package <redacted>;
import java.nio.channels.SocketChannel;
import java.util.*;
import it.gotoandplay.smartfoxserver.db.*;
import it.gotoandplay.smartfoxserver.data.*;
import it.gotoandplay.smartfoxserver.exceptions.*;
import it.gotoandplay.smartfoxserver.extensions.*;
import it.gotoandplay.smartfoxserver.lib.ActionscriptObject;
import it.gotoandplay.smartfoxserver.events.InternalEventObject;
import org.json.JSONObject;
public class Game extends AbstractExtension
{
public void init()
{
System.out.println("init!");
trace("Extension initialized");
}
@Override
public void handleRequest(String cmd, String[] data, User u, int fromRoom)
{
String[] params = new String[] {
"testcommand",
"yes"
};
LinkedList recipients = new LinkedList();
recipients.add(u);
trace ("received str!");
sendResponse(params, -1, null, recipients);
}
@Override
public void handleRequest(String cmd, JSONObject jso, User u, int fromRoom)
{
System.out.println("got handlrequest");
trace ("received a command : " + cmd);
}
public void handleRequest(String cmd, ActionscriptObject ao, User u, int fromRoom)
{
// nothing yet
}
@Override
public void handleInternalEvent(InternalEventObject ieo)
{
String event = ieo.getEventName();
trace ("int event: " + event);
}
}
Here's the code I'm using to send the XT packet in Flash:
Code: Select all
function sendLogin()
{
if (!_global.isBusy)
smartfox.login(zone, login_txt.text, null)
smartfox.sendXtMessage("test", "loginTest", login_txt.text);
}
I know it's sending because I see the output trace say "[Sending]: %xt%test.."