Page 1 of 1

putting users in rooms make a lot of them disconnected

Posted: 05 Nov 2010, 13:35
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);
		}
	} 
}

Posted: 05 Nov 2010, 19:24
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 ?

Posted: 08 Nov 2010, 06:59
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

Posted: 08 Nov 2010, 08:46
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]"

Posted: 08 Nov 2010, 17:11
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