Multiple Rooms Chat Issue

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

Moderators: Lapo, Bax

burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Multiple Rooms Chat Issue

Postby burnside » 11 Mar 2017, 09:48

We have rooms laid out as such:

[lobby] (isGame false)
[game hall] (isGame false)
[tables in game hall] (isGame true, max users 4)

The client is Flash. Players are always joined to both the game hall and their respective table rooms. (always the 2 rooms while playing) All of this is tested and verified via the admin tool.

We setup basic public message sending and receiving and realized it was only working for the players sitting at the tables, whereas we want it to work for everyone in the game hall. I read that the public message request call always sends to the last joined room, so I altered the chat sending to have a target room:

Code: Select all

smartFox.send(new PublicMessageRequest(txt, null, targetChatRoom));


I have done some debugging and know that the targetChatRoom is the appropriate game hall room. I also see the messages show up in the server logs so I know they are being sent. Unfortunately messages sent are not received by everyone in the game hall. Some users receive them, some do not, and we have been unable to establish a pattern. It seems as if I need to also specify a room to be listening for chat messages? What am I missing? Is there some hack I need to do like unjoin/rejoin the great hall room after table joins so that it is always the last joined room for message receiving?

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

Re: Multiple Rooms Chat Issue

Postby Lapo » 11 Mar 2017, 10:08

Can you reproduce the issue in your development environment?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 11 Mar 2017, 15:52

I forgot to mention yesterday:

Flash Client: API Version: 1.1.5
Server: 2.12.3

Yes, we have reproduced it in dev environment.

Is there some way to log the room processing a chat request? All I see is:

Code: Select all

11 Mar 2017 | 07:51:16,426 | INFO  | SFSWorker:Ext:2 | Extensions |     | {bunco}: Chat Handler: Mike Marmot-Heppner4: Yay! They let me play!


Cheers.
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 13 Mar 2017, 05:46

I see our client API may be outdated. We will update and see if that takes care of things.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Multiple Rooms Chat Issue

Postby Lapo » 13 Mar 2017, 09:24

Yes, those are 4-5 years old. :)
Lapo

--

gotoAndPlay()

...addicted to flash games
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 19 Mar 2017, 03:45

So even after update, users still (seemingly randomly) cannot chat with each other.

We join everyone in a game to a non-game room:

Room1 (everyone)

Then we join players to tables in groups:

Table1
Table2
Table3

So any given player is joined to a room and a table while playing.

We are reliably always sending the chats from the client to Room1 as previously described, but for some reason there are frequently people who when they chat, only others at their table can hear them. Is there some way server-side to debug this? Maybe log what room each chat message is passing through?

Thanks!
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 19 Mar 2017, 03:54

Replying to my own post. I think I found a clue.

110 [MainApp] Received chat message:
{message:Having trouble Mandy?, sender:null, room:[Room: Room_1, Id: 3, GroupId: RoomGroup], data:null}
111 [MainApp]
---------|----------------------------------------------------------------------------------------------------
ERROR | Chat message received without sender. Aborting.
---------|----------------------------------------------------------------------------------------------------

Somehow the sender is not coming through, though I know the server receives it. I see this exact message in the log:

17 Mar 2017 | 18:00:34,143 | INFO | SFSWorker:Ext:3 | Extensions | | {bunco}: Chat Handler: Matt L: Having trouble Mandy?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Multiple Rooms Chat Issue

Postby Lapo » 20 Mar 2017, 08:24

burnside wrote:We are reliably always sending the chats from the client to Room1 as previously described, but for some reason there are frequently people who when they chat, only others at their table can hear them. Is there some way server-side to debug this? Maybe log what room each chat message is passing through?

As regards the "missing sender" can you actually reproduce this at will? Or is it random...
Please describe each request sent in a step by step fashion.

Also specify if you're using Room Groups and which group users are joining.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 20 Mar 2017, 19:57

Lapo wrote:As regards the "missing sender" can you actually reproduce this at will? Or is it random...
Please describe each request sent in a step by step fashion.


We cannot reproduce it at will. As users join the game, some can chat to the whole room, others can only chat to their local table.

Imagine for 16 players, each:
- loads the game, enters lobby (client sends join lobby room request)
- selects location (client sends join game room request)
- is initially joined to game table 1 as a spectator so they can watch game in progress (server joins player to table 1 as spectator)
- players that join the game are programmatically sorted into groups for actual gameplay (server unjoins spectators, joins users as players to one of game table 1, 2, 3, etc)

Watching a player through this process using the admin tool verifies proper operation and room subscriptions at each stage.

When messages are sent, the client sets the target as the game room.

For some of the 16, everyone in the game room can see their messages. For the rest only users in the same game table as them can see their messages. As posted above, apparently the message is relayed to all players, but for players not at the same table the sender is stripped.

Possibly useful is that when a player cannot be heard by the room it is consistent that only people at their table can hear them. It does not seem to be the case that some people outside their table can and some people outside their table cannot hear them.

Also possibly useful. After a few rounds in the game (users being moved from game table to game table by the server) whatever is blocking players occasionally seems to clear up and stop blocking them.

One thing I may need to test is when a player is already at table 1 as a spectator and they get assigned table 1 I think that we may just promote them to player rather than unjoining them and rejoining them. But I don't see how this should affect proper operation of the chat.

Lapo wrote:Also specify if you're using Room Groups and which group users are joining.


We use room groups per location. Meaning all of the above 16 players would be in the same group.


Question: Is there any legitimate scenario where a client should be receiving a user generated message with a null sender? I'd think that either they'd get the message or they wouldn't, with the server filtering who receives messages based on their room subscriptions. I don't really see any legitimate reason to strip the sender but still relay the message?

Cheers.
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 24 Mar 2017, 18:17

Following up. Any ideas?

I don't see any situations where a client should be receiving chat messages without the sender included... ?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Multiple Rooms Chat Issue

Postby Lapo » 25 Mar 2017, 08:50

Sorry, for the delay.
About your question (how can a client receive a message with sender == null): the recipient of the message receives the unique ID of the sender and locally the API are expected to resolve it to its user Object by looking it up in the local Room list.

The only scenario that comes to mind is a pretty rare one in which the sender is disconnected right after sending a message and the two events (user disconnect and chat message) cause the local client to first remove the User and then look it up again to notify the message.

What is not very clear is the rate at which this happens

thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 28 Mar 2017, 08:34

Lapo wrote:About your question (how can a client receive a message with sender == null): the recipient of the message receives the unique ID of the sender and locally the API are expected to resolve it to its user Object by looking it up in the local Room list.

The only scenario that comes to mind is a pretty rare one in which the sender is disconnected right after sending a message and the two events (user disconnect and chat message) cause the local client to first remove the User and then look it up again to notify the message.


Unfortunately we are experiencing it without anyone being disconnected.

Going by your explanation, it sounds like when a user is in two rooms simultaneously, the local API is failing to check all subscribed rooms when trying to look up the user object? Can this be fixed? (our client is flash) Or are we going to need to come up with a work-around? We were planning on going live with our app in the next few weeks...

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

Re: Multiple Rooms Chat Issue

Postby Lapo » 28 Mar 2017, 09:06

Going by your explanation, it sounds like when a user is in two rooms simultaneously, the local API is failing to check all subscribed rooms when trying to look up the user object? Can this be fixed? (our client is flash)

Yes it could be fixed, once we get an idea of how to reproduce this and where the source of the issue is.

You haven't replied re: the frequency of this issue. Can this be reproduce at will? Even better, can you reproduce it locally?
If so how?

Final note: when working with multi-rooms (i.e. users joined in more than 1 room) you have to specify the target of a certain message. For instance a public message requires an explicit Room parameter. If not passed the API will fall back to using the last joined Room.
Just wanted to mentioned it, in case it escaped your attention.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
burnside
Posts: 24
Joined: 11 Mar 2017, 09:30

Re: Multiple Rooms Chat Issue

Postby burnside » 29 Mar 2017, 07:33

Lapo wrote:Yes it could be fixed, once we get an idea of how to reproduce this and where the source of the issue is.

You haven't replied re: the frequency of this issue. Can this be reproduce at will? Even better, can you reproduce it locally?
If so how?


I mentioned before, we are unable to reliably replicate it at will.

Lapo wrote:Final note: when working with multi-rooms (i.e. users joined in more than 1 room) you have to specify the target of a certain message. For instance a public message requires an explicit Room parameter. If not passed the API will fall back to using the last joined Room.
Just wanted to mentioned it, in case it escaped your attention.


As mentioned before, we initially thought this was the problem and fixed the client to always specify the room with all of the players in it when sending the message. This reduced the frequency of the issue, but did not completely fix it.

Note that this issue is related to another request by one of our team members here: http://www.smartfoxserver.com/forums/vi ... 19&t=19318

We were unable to use the AS3 joinedRooms array when specifying which room to target when sending a message because the joinedRooms array contained a whole bunch of the player's previous rooms. IE:

Server sees player in: Location_1, Location_1_table_1
Client joinedRooms array sees player in: Location_1, Location_1_table_1, Location_1_table_2, Location_2, Location_2_table_1, etc...

I bring this up because if you are internally using the joinedRooms array to look up the player objects when a new message is received, the discrepancy may be the direct cause, or related to the cause?

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

Re: Multiple Rooms Chat Issue

Postby Lapo » 29 Mar 2017, 08:45

burnside wrote:We were unable to use the AS3 joinedRooms array when specifying which room to target when sending a message because the joinedRooms array contained a whole bunch of the player's previous rooms. IE:

Server sees player in: Location_1, Location_1_table_1
Client joinedRooms array sees player in: Location_1, Location_1_table_1, Location_1_table_2, Location_2, Location_2_table_1, etc...

Well, the joinedRoom array is supposed to keep track of all currently joined Rooms.
We have a test for this, we can join and leave a whole bunch of Rooms and at every iteration the joinedRoom array reflects the state of the player correctly.

In any case, are you saying that in that long list of Rooms that you showed some other room is missing?
Or that there are too many Rooms and you expected to find less?

I bring this up because if you are internally using the joinedRooms array to look up the player objects when a new message is received, the discrepancy may be the direct cause, or related to the cause?

Yes, internally the API keep track of the joined Rooms and relative user lists etc...
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 66 guests