putting users in rooms make a lot of them disconnected

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
psychopixel
Posts: 19
Joined: 14 Apr 2008, 08:44
Location: Italy
Contact:

putting users in rooms make a lot of them disconnected

Post by psychopixel »

Hi, we have developed the tournment version of a burraco card game turn-based. We have a server-side extension that automatically create the tournment rounds. When a referee click a "start turn" button the extension make a loop in which it creates the game room and put inside users then procede to next room.
We have tested this and everything worked fine, now the tournment is in final test on production server. The first tournment worked fine with about 64 people and extension created the 16 rooms needed with no problem. Now we made a bigger test with 92 people but when we tried to "start turn" a lot of people it's been disconnected from the server. Any idea?

Here is the code that creates the rooms and put users inside them, I have put only relevant code and comment for the part of code I excluded.

Code: Select all

for (var x = 0; x < rounds[numRound].length; x++) {
	// create room object newRoomObj with its parameters
	// set room variable rVars
	newRoom = _server.createRoom(newRoomObj, null, true, true, rVars);
	
	if (newRoom != null) {
		var resetRoomVariables = false;
		var vars = [];
		var uVars;
		var nameUser;
		var newRoomId = newRoom.getId();
		var ok = _server.joinRoom(userNord, LOBBY_ID, false, newRoomId, newRoomObj.pwd, false, true);
		if (ok) {
			nameUser = String(userNord.getName());
			uVars = { };
			uVars.table = String(newRoomObj.name);
			_server.setUserVariables(userNord, uVars);
		} else {
			resetRoomVariables = true;
			vars.push( { name:"nord", val:"" } );
		}
		// do the same with other 3 users
		if (resetRoomVariables) {
			_server.setRoomVariables(newRoom, null, vars);
		}
	} 
}
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

Did you get any warnings in your log file when those disconnection had occurred?

94 users in one room is pretty heavy, but this also depends on the frequency and size of data being sent to everyone as well as receiving. Check your Admin tool and check if there's a high dropped outgoing or incoming messages.

Have you read and understood the dropped messages via http://www.smartfoxserver.com/docs/docP ... ooting.htm ?
Smartfox's forum is my daily newspaper.
Harpo
Posts: 1
Joined: 06 Apr 2009, 06:16

Post by Harpo »

So is it possible that an excessive number of requests to join users in a room causing the disconnection of themselves?

In this case we (I'm working with psychopixel) can resolve the problem by replacing the loop (for) with a timer (setInterval) creating a delay between a user and the others?

Thanks
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Post by BigFIsh »

So is it possible that an excessive number of requests to join users in a room causing the disconnection of themselves?
It is possible. Instead of using a timer, why not send a command to each players which in turn brings up a dialog saying "A game have been created! Join it? [Yes] [No]"
Smartfox's forum is my daily newspaper.
Flappi282
Posts: 158
Joined: 20 May 2009, 17:51
Contact:

Post by Flappi282 »

Umm you can achieve that by

_server.sendResponse({cmd:"newgame", gameid: newroom.getId()}, -1, _server.getCurrentZone.getRoom(Number(fromRoom)).getUserList())

Im on my iPod and I know the code is wrong. Ill fix it later
--
Flappi282
Post Reply