I'm trying to do something very simple: open a room in the zone extension:
Server code:
Code: Select all
function init() {
addRequestHandler("FindRoom", onFindRoom);
}
function onFindRoom(event, sender) {
var cfg = new CreateRoomSettings();
cfg.setName("232323s");
cfg.setGame(true);
cfg.setMaxUsers(10);
cfg.setMaxSpectators(5);
cfg.setDynamic(true);
var myNewRoom = getApi().createRoom(getParentZone(), cfg, null);
}
Client code:
Code: Select all
//Server.connection is the SmartFox instance
Server.connection.send(new SFS2X.ExtensionRequest("FindRoom", null));
I get an exception:
Code: Select all
java.lang.ClassCastException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: java.lang.ClassCastException
Message: Cannot cast jdk.nashorn.internal.runtime.Undefined to com.smartfoxserver.v2.entities.Room
Description: Java Error invoking Javascript function: $$handleClientRequest
I thought this was pretty straight-forward, am I missing something?
Thanks!