How to handle create room request on server side

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

Moderators: Lapo, Bax

grhwood
Posts: 116
Joined: 15 Mar 2011, 04:43

How to handle create room request on server side

Postby grhwood » 15 Mar 2011, 06:23

Hi,

How can i manually create room on server side using extensions when a client fire a CreateRoomRequest ?

I see in the SFSEventType class, there is ROOM_ADDED event but it is fired after a room is created.

Thank you.
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 15 Mar 2011, 13:21

To create a room on the server-side, send a custom extension request and then use the SFSApi.createRoom method.
Paolo Bax
The SmartFoxServer Team
grhwood
Posts: 116
Joined: 15 Mar 2011, 04:43

Postby grhwood » 16 Mar 2011, 02:45

bax wrote:To create a room on the server-side, send a custom extension request and then use the SFSApi.createRoom method.


So does this means i cannot interfere when client send CreateRoomRequest?
If it is the case, how can i disable the CreateRoomRequest sent from client ?

Thank you.
User avatar
Bax
Site Admin
Posts: 4612
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 16 Mar 2011, 11:42

You can't put your logic in the middle of a default client request.
You have to use your extension:

- from the client send a custom extension request containing the data you need to create the room;
- make your validations and then create the room on the server-side using SFSApi.createRoom;
- if you like you could also fine tune the user permissions by inhibiting the client-side CreateRoomRequest using the Privilege Manager in the Admin Tool: this will eventually prevent malicious clients to send room creation commands.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 97 guests