I tried to make an extension and attached it to a room
After that I added a request handler, but when i try to use the extension i got this error
What went wrong?
Thanks in advance
Room Extension can't be invoked?
Re: Room Extension can't be invoked?
Can you show me the client code used to call the Extension?
Re: Room Extension can't be invoked?
Code: Select all
ISFSObject ObjOut = new SFSObject ();
ObjOut.PutUtfString ("User", "black");
ObjOut.PutInt ("count", 30);
ObjOut.PutUtfString ("Room", "room1");
//current room is room object
sfs.Send (new ExtensionRequest ("starttimer",ObjOut,currentroom));
this one for the server side
Code: Select all
public class RoomExtension extends SFSExtension{
@Override
public void init()
{
addRequestHandler("starttimer", TimerHandler.class);
}
}
timerhandler class
Code: Select all
public class TimerHandler extends BaseClientRequestHandler{
public void handleClientRequest(User user, ISFSObject ObjIn){
String kuser = ObjIn.getUtfString("User");
count = ObjIn.getInt("count");
String kroom = ObjIn.getUtfString("Room");
room = getParentExtension().getParentZone().getRoomByName(kroom);
user = getParentExtension().getParentZone().getRoomByName(kroom).getUserByName(kuser);
getApi().sendPublicMessage(room, user, "success", null);
}
}
Re: Room Extension can't be invoked?
Thanks.
The client code looks code.
I would recommend to double check that the Extension was launched correctly when the Room is created. You can add a trace command in your init() method to make sure everything is okay:
Also check the logs for errors at the time of the creation of the Room.
Other than that it all looks good.
The client code looks code.
I would recommend to double check that the Extension was launched correctly when the Room is created. You can add a trace command in your init() method to make sure everything is okay:
Code: Select all
public void init()
{
trace("Extension started OK");
...
}
Also check the logs for errors at the time of the creation of the Room.
Other than that it all looks good.
Re: Room Extension can't be invoked?
It seems the problem is on the timer code that I try to inject
Can you help me what's wrong with my timer code
this one is a simple code trying send a public message each second
The location is currently in main extension of a zone extension
Can you help me what's wrong with my timer code
this one is a simple code trying send a public message each second
Code: Select all
room = getParentZone().getRoomByName("time");
task = new TimerTask()
{
public void run(){
getApi().sendPublicMessage(room, null, "t" , null);
}
};
timer.scheduleAtFixedRate(task, null, 1000);
The location is currently in main extension of a zone extension
Re: Room Extension can't be invoked?
Is there a specific error? If so post the stack trace.
Also make sure to review how to create tasks to be submitted to the Scheduler, your code is not handling exceptions as we recommend.
http://docs2x.smartfoxserver.com/Gettin ... wtos#item7
Thanks
Also make sure to review how to create tasks to be submitted to the Scheduler, your code is not handling exceptions as we recommend.
http://docs2x.smartfoxserver.com/Gettin ... wtos#item7
Thanks
Re: Room Extension can't be invoked?
I tried the scheduler and it works like charm
So finally I noticed that the problem is not only timer but also the sending a message from the server side and after changing to admin message, even room extension now works
Thanks for the help
Now i just need to find the way to attach room extension on the client's script when they make a room
So finally I noticed that the problem is not only timer but also the sending a message from the server side and after changing to admin message, even room extension now works
Thanks for the help
Now i just need to find the way to attach room extension on the client's script when they make a room
Who is online
Users browsing this forum: No registered users and 89 guests