No Extensions can be invoked

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

wilprim
Posts: 6
Joined: 19 Jan 2018, 18:37

No Extensions can be invoked

Postby wilprim » 19 Jan 2018, 18:42

I am working on learning about extensions and I keep getting this error:

Code: Select all

11:48:48,488 INFO  [SFSWorker:Sys:1] api.SFSApi     - Room joined: [ Room: Lobby, Id: 0, Group: default, isGame: false ], { Zone: Sandbox }, ( User Name: wilprim, Id: 2, Priv: 0, Sess: 127.0.0.1:49925 ) , asSpect: false
11:48:48,603 WARN  [SFSWorker:Ext:4] v290.ExtensionReqController     - com.smartfoxserver.v2.exceptions.SFSExtensionException: No extensions can be invoked: { Zone: Sandbox }, RoomId: None
   com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:157)
   com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   java.lang.Thread.run(Thread.java:745)


I have built a simple extension that traces ("hello " + username);

MyExtension:

package MyExtension;

import com.smartfoxserver.v2.extensions.SFSExtension;
import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;

Code: Select all

public class MyExtension extends SFSExtension {

   @Override
   public void init() {
      this.addRequestHandler("hello", Hello.class);
   }
   
   public class Hello extends BaseClientRequestHandler{

      @Override
      public void handleClientRequest(User sender, ISFSObject params) {
         String username = params.getText("name");
         trace("Hello " + username);
         
      }
   
      
   }

}


And this is what I am doing in Unity...

Code: Select all

void Start(){
         if (sfs != null) {
            sfs.AddEventListener (SFSEvent.EXTENSION_RESPONSE, NewExtResponse);
            sfs.AddEventListener (SFSEvent.CONNECTION_LOST, ConnectionLost);
         }

         ISFSObject obj = new SFSObject ();
         obj.PutText ("user", "Wil Prim");
         Debug.Log (sfs.IsConnected);
         sfs.Send (new ExtensionRequest ("hello", obj));
      }


      #region SFS Event Listeners
      void NewExtResponse(BaseEvent e){
         Debug.Log ("Response");
      }

      void ConnectionLost(BaseEvent e){
         SceneManager.LoadScene ("Login");
      }
      #endregion



I honestly have no clue what is happening... Please help.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: No Extensions can be invoked

Postby Lapo » 20 Jan 2018, 10:40

Hi,
is the Extension attached to a Room or Zone?
Your client code is calling without specifying any Room so if the Extension is attached at Room Level this won't work.

Also make sure that in your logs no exceptions exist when the Zone is started up, If the Extension throws errors at init time it will be invalid and cause errors if one attempts to invoke it later.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
wilprim
Posts: 6
Joined: 19 Jan 2018, 18:37

Re: No Extensions can be invoked

Postby wilprim » 27 Jan 2018, 17:51

Got it. Wasn't calling the specific room. :lol:

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 60 guests