i try to create a new room in server side
in server extention , I use this code :
Code: Select all
void OnMatchMatchMaking(User user,ISFSObject params){
PaperExt parentExtension = (PaperExt)getParentExtension();
ISFSObject objOut = SFSObject.newInstance();
CreateRoomSettings str = new CreateRoomSettings();
str.setAutoRemoveMode(SFSRoomRemoveMode.WHEN_EMPTY);
str.setName(user.getName() + ":game");
str.setMaxUsers(2);
str.setGame(true);
try {
getApi().createRoom(user.getZone(),str, user);
} catch (SFSCreateRoomException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
parentExtension.send("MatchMaking", objOut,user);
}
}
And for calling this code in c#
Code: Select all
var ISObject = new SFSObject();
ISObject.PutUtfString("__[[REQUEST_ID]]__", "MatchMaking");
sfs.Send(new Sfs2X.Requests.ExtensionRequest("NewRoom", ISObject));
But nothing will happen on the server side
server log :
Code: Select all
java.lang.NullPointerException
com.smartfoxserver.v2.controllers.system.ManualDisconnection.execute(ManualDisconnection.java:29)
com.smartfoxserver.v2.controllers.v290.SystemReqController.processRequest(SystemReqController.java:157)
com.smartfoxserver.v2.controllers.v290.SystemReqController.enqueueRequest(SystemReqController.java:114)
com.smartfoxserver.bitswarm.io.protocols.AbstractProtocolCodec.dispatchRequestToController(AbstractProtocolCodec.java:39)
com.smartfoxserver.v2.protocol.SFSProtocolCodec.dispatchRequest(SFSProtocolCodec.java:125)
com.smartfoxserver.v2.protocol.SFSProtocolCodec.onPacketRead(SFSProtocolCodec.java:90)
com.smartfoxserver.v2.protocol.binary.BinaryIoHandler$1.run(BinaryIoHandler.java:525)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
Code: Select all
com.smartfoxserver.v2.exceptions.SFSRuntimeException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: com.smartfoxserver.v2.exceptions.SFSRuntimeException
Message: -Unexpected- Cannot find any User for Session: { Id: 241, Type: DEFAULT, Logged: No, IP: 5.161.111.58:25101 }
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.SmartFoxServer.onSessionReconnectionTry(SmartFoxServer.java:977)
com.smartfoxserver.v2.SmartFoxServer.access$5(SmartFoxServer.java:972)
com.smartfoxserver.v2.SmartFoxServer$EventDelegate.run(SmartFoxServer.java:1070)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)