Client not updating active room ID when changed by server

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

Moderators: Lapo, Bax

mugambs
Posts: 32
Joined: 11 Dec 2008, 12:05
Location: United Kingdom

Client not updating active room ID when changed by server

Postby mugambs » 25 Mar 2010, 16:04

We are noticing that the smartfoxclient.dll used in our Unity app does not pick up changes to the activeRoom when its changed by the server.

So when we move the player to a new room from the server, the DLL doesnt get notified of it. Is there any way we can force this to pick up the change? Is it a bug in the client API? Bad design on our server side?

Speaking to Thomas Lund on the .NET API page of the forum, it seems the extension needs to notify the client of this change. However, since we are overriding most internal APIs e.g. getRoomList, getUserList, joinRoom, onUserEnteredRoom, onUserLeaveRoom etc, i dont know how to do this.

Also, i dont want the additional bandwidth of having to send a packet to the client to keep its activeRoomId in sync. Ideally, I think our client should track the activeRoom as a global variable - however, im not sure whether the sync issue could cause other complications in built-in client functions that depend on the activeRoomId.

Hope that made sense.

P.S. I wasnt sure how to move this post from the .NET forum to this one, so i created a new topic. Heres the old link if one of the admins wants to remove it.

viewtopic.php?t=7092

Thx

Mugambs
Sappho
Posts: 74
Joined: 29 Mar 2009, 19:23
Location: Slovakia

Postby Sappho » 26 Mar 2010, 13:06

I am not sure i understand what your exact problem is, but basically if you stop all the native events propagation and don't propagate it yourself then the client API has no chance of picking up the event that is needed for activeRoom change. This is not a client API problem since client can't know about the change when the server didn't say anything.
cosmicmesh
Posts: 2
Joined: 16 Mar 2010, 17:24

Postby cosmicmesh » 26 Mar 2010, 13:28

Mugambs,

I have been seeing a similar issue (.NET client says the active room is -1, regardless of what I do on the server). I saw this issue crop up when I implemented a custom (secure) login handler.

I changed how I call joinRoom on the server, to set the last param to true (to send a broadcast event). When I do this, the client now stays in sync.

public boolean joinRoom(User usr,
int currRoom,
int newRoom,
boolean leaveRoom,
java.lang.String pword,
boolean isSpectator,
boolean broadcast)


Is there another way to do this? I don't want to send an update to EVERY client so one client can go to the right room... I also don't necessarily want every client to know who every other client is.

I'm relatively new to SFS so I'm hoping someone can tell me if I am missing something.

Thanks.
mugambs
Posts: 32
Joined: 11 Dec 2008, 12:05
Location: United Kingdom

Postby mugambs » 27 Mar 2010, 13:49

cosmicmesh, if you are only implementing a custom login handler, and using the other native functions e.g. joinRoom etc it would probably be easier if you let the client call joinRoom, rather than the server doing it.

I had a similar situation at the start of the project, where I wanted the server to decide which room a player should join at the time they login. What i chose to do was return the startingRoom name in the login response - then the client can call joinRoom. That way your client and server stay in sync.

However, my problem now is that im phasing out nearly all the native APIs. A few reasons for doing this
1. I get to use JSON instead of XML
2. I can filter who gets the broadcasts based on various bits of business logic
3. I think it makes clustering easier

The fact that the client and server fall out of sync isnt really an issue in itself unless theres some native API that has a dependancy on the clients version of activeRoom. The main one would be sendXTMessage, particularly when sending using the Raw protocol. In my extension is the fromRoom:int param passed to the handleRequest() method determined by the server, or from the client? My guess is its the server, but im not sure.

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 48 guests