Sending extension response from handler outside

Post here your questions about the Java client / Android API for SFS2X

Moderators: Bax, Lapo

Sending extension response from handler outside

Postby freeandoni » 28 Feb 2012, 19:08

Hello,

I'm using a thread outside BaseClientHandler and I want to send a extension request from there.

Is there a way?

I have tried with this but I'm not receiving the response on the client:

Code: Select all
       
        APIManager api = new APIManager();
        api.getSFSApi().sendExtensionResponse("POSITION_UPDATE_RESPONSE", sfsobject, user, user.getLastJoinedRoom(), false);


I'm not sure if this the correct way.
freeandoni
 
Posts: 14
Joined: 28 Feb 2012, 19:02

Re: Sending extension response from handler outside

Postby rjgtav » 28 Feb 2012, 23:48

Hi.
No, you're creating a new APIManager, of course it won't work. You have to use the one that SFS uses.
If your handler extends the BaseClientRequestHandler class, then you can simply do:

Code: Select all
send("POSITION_UPDATE_RESPONSE", sfsobject, user, user.getLastJoinedRoom(), false);
Skills: SFS Pro/Basic, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS
SFS Tutorials: http://sfs-tutor.blogspot.com/ - I no longer update it nor visit it. Some examples may be bugged.
If I take too long to reply, feel free to PM me
User avatar
rjgtav
 
Posts: 2811
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Sending extension response from handler outside

Postby freeandoni » 01 Mar 2012, 11:38

finally I used this:

Code: Select all
SmartFoxServer.getInstance().getAPIManager().getSFSApi().sendExtensionResponse(name,data,user,room,false);
freeandoni
 
Posts: 14
Joined: 28 Feb 2012, 19:02


Return to SFS2X Java / Android API

Who is online

Users browsing this forum: No registered users and 1 guest