Curiosity about reconnection

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

Moderators: Lapo, Bax

Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Curiosity about reconnection

Postby Ardito » 18 Sep 2019, 08:57

Hi,
I have documented a lot about the reconnection of SFS2x, I understood:
- To activate the reconnection simply enter a value> 0 in the administration page to the user reconnection frame.
(I am developing a turn-based card game, of which each round lasts from 1 to 30 seconds, for this reason I put the user reconnection frame 30 seconds)
- If the Ethernet cable or Wifi is disconnected, this event has no way of working.

I do not understand:
- When the user reconnection frame timer ends, what happens? Does the server try to send the client a Disconnect event?
- If the application is closed by mistake while in the game, how can the connection be re-established?
- If the application is closed by mistake while in the game, how can the user be returned to the current status of the game?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Curiosity about reconnection

Postby Lapo » 18 Sep 2019, 09:35

Hello,
Ardito wrote:- When the user reconnection frame timer ends, what happens? Does the server try to send the client a Disconnect event?

No. The client already knows that the previous connection is lost.
When the timer is over the disconnect event is fired on the client. From the server side the User and relative session are removed.

- If the application is closed by mistake while in the game, how can the connection be re-established?

No, because the client has lost all of its state, which is necessary to continue the game.

- If the application is closed by mistake while in the game, how can the user be returned to the current status of the game?

In this case you need to implement your own reconnection logic, based on how your game works.
Typically you will need to be able to transmit the necessary data to the client so that it can restore the previous game state.

Example: if you detect a client has disconnected while in game you could store a "disconnected" flag in this player profile (maybe on the DB) and the next time he will reconnect you can check if it's still possible to put the player back into the game.

All this can work in conjunction with the existing reconnection-system, as you will get a "disconnected" event only after the regular reconnection attempts have already failed.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Curiosity about reconnection

Postby Ardito » 18 Sep 2019, 09:47

Thank you, you clarified all my doubts
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Curiosity about reconnection

Postby Ardito » 18 Sep 2019, 09:56

When the user in the game disconnects, at the next request of the other player, the SFS2x console print this Warning, and the game does not continue:

Code: Select all

12:01:01,309 WARN  [SFSWorker:Ext:3] v290.ExtensionReqController     - com.smartfoxserver.v2.exceptions.SFSExtensionException: No extensions can be invoked: { Zone: Login }, RoomId: 6
        com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:157)
        com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
        java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)

12:01:07,880 WARN  [SFSWorker:Ext:2] v290.ExtensionReqController     - com.smartfoxserver.v2.exceptions.SFSExtensionException: No extensions can be invoked: { Zone: Login }, RoomId: 6
        com.smartfoxserver.v2.controllers.v290.ExtensionReqController.processRequest(ExtensionReqController.java:157)
        com.smartfoxserver.v2.controllers.v290.ExtensionReqController$1.run(ExtensionReqController.java:68)
        java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)


What can this Warning depend on?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Curiosity about reconnection

Postby Lapo » 18 Sep 2019, 15:32

Hi,
it's difficult to say. We would need to understand how to reproduce the problem.
The description you have given does not reproduce it, unless some other steps are missing. We'll need more details.

Thanks.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Thomasea and 73 guests