Page 1 of 1

Sending extension response from handler outside

Posted: 28 Feb 2012, 19:08
by freeandoni
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.

Re: Sending extension response from handler outside

Posted: 28 Feb 2012, 23:48
by rjgtav
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);

Re: Sending extension response from handler outside

Posted: 01 Mar 2012, 11:38
by freeandoni
finally I used this:

Code: Select all

SmartFoxServer.getInstance().getAPIManager().getSFSApi().sendExtensionResponse(name,data,user,room,false);