disconnect from server when use not stable connection

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

Moderators: Lapo, Bax

adifong
Posts: 20
Joined: 10 Aug 2016, 06:50

disconnect from server when use not stable connection

Postby adifong » 29 Nov 2018, 09:53

Hi,

i have some issue about disconnect from server.
so when i connect to the room game with mobile wifi connection/3g connection, and then i play about 5 minutes or more i get disconnect from server.
but if i play use desktop cable internet connection i can play all day..

i think the connection with wi fi is not stable, is there any solution when the wifi connection is not stable but the user no need to disconnect from server, because maybe it only 10 second and then it can still continue playing when the connection is back?

Re: Server disconnecting lots of clients
Postby Lapo » 04 May 2013, 07:24

Let me clarify one important aspect. The server never ever disconnects anybody unless two criteria are met:

1- the client has been idle for longer than your server side settings
2- the client is too slow and keeps dropping packets until it must be disconnected

Every other instance of disconnection must be researched outside SFS: client bad connection, bandwidth saturation, network error...

My first recommendation is to check the dropped packet count in the server's AdminTool Dashboard and see if there's any problem there.


i read some answer from this, but i still not sure how to fix my problem..

thanks,

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

Re: disconnect from server when use not stable connection

Postby Lapo » 29 Nov 2018, 14:31

Hi,
you can try to enable the reconnection system and support it in your client side:
http://docs2x.smartfoxserver.com/Gettin ... n-hrc-plus

Essentially you just need to change 1 setting in the server Zone and add two event handlers in your client:
SFSEvent.CONNECTION_RETRY
SFSEvent.CONNECTION_RESUME

You can check the client side documentation for more details.

Also if your game is kind of slow, meaning that it doesn't send many messages per second, you may want to implement a simple "keep-alive" mechanism by sending an empty Extension request to the server. This is useful if your app/game can have pauses where it doesn't send any data for at least 20-30 seconds.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 140 guests