{ Update } Actionscript 2/3 API 1.6.3

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
Lapo
Site Admin
Posts: 21117
Joined: 21 Mar 2005, 09:50
Location: Italy

{ Update } Actionscript 2/3 API 1.6.3

Postby Lapo » 18 May 2010, 08:22

Hello,
this is a new AS 2/3 API release (1.6.3) that addresses a couple of problem found recently:

1 - Multiple calls to getRoomList() could return a wrong list containing Rooms that are no more in existence.
2 - Better handling of errors during low-level message decoding (AS3 only)

The update requires SmartFoxServer 1.6.6 or higher.
You can quickly update by downloading the API here.

Installation and usage:
Unzip the folder to any location on your hardrive
Point your Flex/Flash classpath to the folder just created and recompile your application.

Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 06 Jul 2010, 15:41

Lapo,

I was experiencing a bug where empty rooms were persisting in the room list and was referred to this post to get the latest AS3 API to resolve the issue.

However, with this latest API implemented, I am experiencing an even more perplexing problem: Extension responses are not being received on the client side.

I have tested the situation in numerous configurations. The problem is nonexistent if you're trying to connect to a SFS that's running on the same machine as your client. When trying to connect to a SFS on a different machine on your local network, it may sometimes receive the EXT response, but will mostly not. When trying to connect to a remote server, extension responses are simply not being received at all.

My game uses a custom login extension, and via the trace statements in the Admin tool, I have verified that user variables are being properly created during the login procedure and that the server is sending the login response. The problem is definately on the client side and only happens with this newer API (previously, I was using the API packaged with the 1.6.8 server update). My Smart Fox servers are running 1.6.8.

I wonder if this issue might relate to a warning I got when using the Flash API packaged with the 1.6.8 server update:

*************************************************************
Warning:
The room list is empty!
The client API cannot function properly until the room list is populated.
Please consult the documentation for more infos.
*************************************************************

This warning pops up after the login extension is received (which sets a series of user related variables before requesting the roomlist). However, the warning does not appear to cause any problems with the game.

Once again, prior to updating to this newer API, everything with the game's login functioned properly.

Any thoughts on what's causing this issue?
Check out my SFS Multiplayer Game:
www.heromages.com
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 06 Jul 2010, 15:59

I reviewed your Login Extension documention again and it appears the client should be able to receive extension reponses prior to getting the room list. The bottom page of the Login Extension documentation (Section #5 of Chatper #8 SFS PRO Tutorials):

NOTE: The next step [after receiving successful login extension response] will be to request the room list to the server by calling smartfox.getRoomList()


Therefore, I'm not sure what that warning in the older API I was getting was all about. Nonetheless, the warning does not appear in this newer API and the problem still stands that, for this newer API, extension responses are not being received by the client.
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Lapo
Site Admin
Posts: 21117
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 07 Jul 2010, 07:15

I reviewed your Login Extension documention again and it appears the client should be able to receive extension reponses prior to getting the room list. The bottom page of the Login Extension documentation (Section #5 of Chatper #8 SFS PRO Tutorials):


Yes, that's correct. If you get the room list warning it means that you are sending a request (createRoom, join, public message...) BEFORE you have obtained.

We never had problems like the one you have mentioned with version 1.6.3, however an update was released a little later which will probably be included in the next SFS release (1.6.9)
If you want you can get it here SFS_API_AS3_164.zip
There's no problem with custom login.

Code: Select all

for this newer API, extension responses are not being received by the client.

We have no idea of how to reproduce this problem.
A simple test is to run your client in Flash, turning on the debug feature of the SFS API and checking the messages and errors.

If you have more details let us know
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 07 Jul 2010, 15:26

Lapo,

I downloaded your latest API, but it has the same issue.

I created a simple test by removing all of my game code and focusing only on the login extension. Using this example, I uncovered some more information. The EXT response is received if I eliminate database queries in the login extension that are being used to pass data relevant to the user when they login.

During the login process, my extension looks up the username of the person logging into the server and finds their stats, maplist, current news items, etc. in the database and packages this information in the response. I am able to trace in the Admin tool that all of this information is being packaged successfully (there are no hang ups in the MySQL queries whatsoever) and I can also confirm that the extension waits until all of the information is packaged before sending the extension response.

However, as I mentioned previously, the client will frequently fail to receive the extension response (especially when I run all of the MySQL queries) but will succeed if I forgo this step. The location of the SFS (whether it is on the same machine as client, on the same network, on on remote location) also plays a factor. I should also mention that the database I am connecting to is located remotely from the machine running the SFS instance.

I configured my SFS to accept up to 1MB messages (and the Admin tool shows no Dropped-In/Dropped-Out messages) PLUS I never had any issues with previous AS3 API. Also, it doesn't make sense this is the problem since it sometimes works/sometimes doesn't.

My suspicion is that this new API has some sort of timeout feature whereby if it does not receive the login EXT response in a certain period of time, it gives up.

If you would like, I could setup a remote database for you and send a simple client side example, a server config file, and a server extension with login so you can see this for yourself.
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 07 Jul 2010, 15:54

Lapo,

I also enabled the SFS debug mode on the client side and discovered some more interesting behavior.

Apparently, the client IS receiving something from the server once the EXT response is sent. Oddly, however, the message received is broken.

I examined two cases, one were the client logged in successfully and one where it did not. In the one that didn't work, the received message displayed only the tail end of the full message (it was literally cut in the middle of one of the data strings being sent). Since the broken message did not contain the <msg t='xt'> tag, I now understand why my trace statement in the extension response listener wasn't catching anything. In fact, the client probably had no idea what to even do with the message since it was incomplete and therefore not formatted correctly.

Also, the behavior is not just in the login extension. In cases where I was able to login successfully, I tried loading my leaderboard and received similar cases where the extension response message came in as incomplete/broken and resulted in a hangup.

Have any other SFS users been experiencing issues with the new API?
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 07 Jul 2010, 16:38

Lapo,

I have isolated the exact change you made to the AS3 API that is causing the problem.

In your SmartFoxClient.as, you changed the byteBuffer:ByteArray variable from being a private variable of the SmartFoxClient class to being a local variable of the private function handleSocketData.

If I comment out line 3010 of SmartFoxClient.as

Code: Select all

//var byteBuffer:ByteArray = new ByteArray()

and add the following code to line 3006

Code: Select all

private var byteBuffer:ByteArray = new ByteArray();

my issue is completely resolved.

Why was byteBuffer changed from a class variable to a function variable? Should/will this change be reversed for future release of the AS3 API?
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 07 Jul 2010, 17:43

I found this topic which described a similar issue to problem I was experiencing. Perhaps the two issues are related:
viewtopic.php?p=31809#31809
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Lapo
Site Admin
Posts: 21117
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 07 Jul 2010, 21:17

But that topic is about Unity3D API written in C#
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 07 Jul 2010, 21:27

Lapo wrote:But that topic is about Unity3D API written in C#


I made the connection to that issue searching for topics with "byteBuffer". Maybe the Unity API has a similar flaw with that property being coded as a local function variable instead of as a class variable.

BTW, any thoughts on the new information I added to this post? Why was the byteBuffer changed to a local function variable? This change is what is causing my extension responses to be sparatically received as incomplete messages.
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Lapo
Site Admin
Posts: 21117
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 08 Jul 2010, 12:23

Sorry Ross, when I answered your last post I didn't notice you already posted other stuff. Not easy to answer directly. I am filing a bug report. Should be able to update you the next week.

Stay tuned.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 10 Jul 2010, 23:47

Thanks, Lapo. I'll continue you to provide updates and information to help resolve this issue.

I did confirm today that the newer API does resolve the roomlist problem I was having. The reason I came to this post is because one of my users recognized a bug with my roomlist and recommended the newer API.

With the API included in Server v1.6.8 ZIP file, I had this problem:
1) Login with two users (A and B)
2) Have both users each create their own game room
3) Have player A exit game room
4) Have player B exit game room
5) Player B will see Player A's game as a ghost room in the roomlist

I tested the same procedure with the newer API (after I applied my fix described above to correct the API extension bug), and the ghost room issue was resolved.
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 15 Jul 2010, 07:41

Are there any updates on this topic?
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Lapo
Site Admin
Posts: 21117
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 15 Jul 2010, 16:50

Currently very swamped and a little late here, sorry about that. :(
We'll get back to you as soon as possible.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 21117
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 09 Aug 2010, 14:02

Hi,
we have been working on a fix for this issue of the beta API. Unfortunately the experimental change didn't work as expected. Your observations were correct plus there was another issue related with fragmented packets.

We're publishing the official SFS PRO 1.6.9 patch very soon which will also contain the new AS3 API update.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 19 guests