Hello,
Wanted to do a follow up on this topic, since i've done some more tests and wanted to share results, maybe you could have some pointers.
Setup:
Client Api version: 2.13
Server version: 2.13
Case 1:
Player 1 joins room, Player 2 joins room, TaskScheduler starts, StartGame message is sent. All fine here.
Game Ends, Players still in room, TaskScheduler cancelled, TaskScheduler started again, StartGame message sent, WebGL clients get dropped.
Unity console doesnt trace the receiving of the StartGame Message, it displays:
Code: Select all
[SFS > ERROR] [WebSocketLayer] Communication error: An exception has occurred while receiving a message. at WebSocketSharp.WebSocketFrame+<ReadAsync>c__AnonStorey1A.<>m__2E (System.Byte[] header) [0x00000] in <filename unknown>:0
at WebSocketSharp.Ext+<ReadBytesAsync>c__AnonStoreyD.<>m__1D (IAsyncResult ar) [0x00000] in <filename unknown>:0
SmartfoxServer logs:
Case 2
Is similar to Case 1, the only difference is on the server side code. When the Game ends, I Send the StartGame message first, then Cancel the TaskScheduler, and Start it again. This doesn't drop the WegGL clients.
Case 3:
When leaving a room, the server updates the room's occupation numbers (like say, if 2 users are in 1 room, a 3rd user in the lobby would see that that room has 2 players in it, if a player leaves that room, the 3rd player would receive a RoomUpdate message with the number of remaining players for the room he left. This goes for every other room opened).
Knowing this the following happens. I have 2 Clients in 1 room, a Android Client and a WebGL client.
If both leave at the same time or leave in any order, if the webgl's lobby scene hasnt loaded completely yet, it will get disconnected after receiving the the RoomUpdate message, while sending the next PING_PONG messages back and forth i believe, with the following unity log:
Code: Select all
[SFS > ERROR] [WebSocketLayer]Communication error: An error has occurred in sending the data
If the WebGL leaves first and the lobby scene is fully loaded, then the android leaves, the webgl client remains connected and receives the RoomUpdate and updates correctly with the number of players in that room, and no errors are thrown.
SmartfoxServer log:
This would point out to a client api problem, the thing is, I've tested the above cases on server version 2.12, and none of them have the same results as on server version 2.13.