Page 1 of 1

Some short clarifications ....

Posted: 18 Sep 2008, 09:25
by Sandyx
hi

Code: Select all

smartFoxObject.sendXtMessage(GAME_EXTENSION, cmd, obj, SmartFoxClient.XTMSG_TYPE_JSON,this.getRoomId())
in our application each game type on the client, has its own class, and which manages the gameplay etc etc ... when that class needs to send a message to the server , we use the above code ...

couple of questions .....

1]GAME_EXTENSION , is this required , or is there a way for the server to get this info from the room id which is being sent ... this.getRoomId() ...


2]it seems we can sent any message to any room event if i am not in it ... for example if the above code i did


Code: Select all

smartFoxObject.sendXtMessage(GAME_EXTENSION, cmd, obj, SmartFoxClient.XTMSG_TYPE_JSON,99)

and the game 99 existed for the extension .. i would get a

handleRequest called on in the extension instance of game 99 .....


to avoid this .. i have had to write this code ..

Code: Select all

function handleRequest(cmd, params, user, fromRoom) {

		var isInRoom = isUserInRoom(user)
		trace("handleRequest(" + cmd + ") fromRoom = " + fromRoom + " isInRoom= " + isInRoom);
		if(isInRoom == false)
		{
			traceEx("**** CROSS ROOM ERROR ****");
			return;
		}
}
Is this cross room chatter by design .... , or am I doing something wrong ......



last but by far not the least ... everyone talks about the extensionHelper ,,is it available to the server side for AS extensions ... how can i use i the same in AS .....

Posted: 18 Sep 2008, 09:37
by Lapo
1]GAME_EXTENSION , is this required , or is there a way for the server to get this info from the room id which is being sent ... this.getRoomId() ...
The name must be passed, because you might have multiple extensions running in the same place (Zone or Room)
2]it seems we can sent any message to any room event if i am not in it ... for example if the above code i did
Correct. Before talking to an extension you need to join a room.
It's important for security reasons and it enforces the use of Room as a user containers.
Take a look at this document -> http://www.smartfoxserver.com/docs/docP ... ecture.htm

Code: Select all

and the game 99 existed for the extension .. i would get a
handleRequest called on in the extension instance of game 99 ..... 
The last param allows you to change the ID of the room from where the request was sent. It's there only for particular cases, 99% of the cases it's not needed and the API will use your current room Id
last but by far not the least ... everyone talks about the extensionHelper ,,is it available to the server side for AS extensions ... how can i use i the same in AS .....
The ExtensionHelper class is the entry point for the server side API in Java.
It's the equivalent of the _server object in AS

Posted: 18 Sep 2008, 09:54
by Sandyx
hi

thanks for the reply .. couple of comments..
Correct. Before talking to an extension you need to join a room.
It's important for security reasons and it enforces the use of Room as a user containers.
Take a look at this document ->
correct ... but our situation .. he can be in multiple rooms .. so the client class needs to put the roomID .....
It's the equivalent of the _server object in AS
:) .. was thinking that was the same .... but want sure ..