USER_DISCONNECT

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

Moderators: Lapo, Bax

Sreedhar_cd
Posts: 8
Joined: 22 Mar 2023, 08:37

USER_DISCONNECT

Postby Sreedhar_cd » 22 Mar 2023, 08:54

Iam new to SmartFox.
Iam trying to find a way how we can identify disconnection by internet etc. Implemented USER_DISCONNECT at zone level and deployed on the server. After that connected with a sample client and turn off my wifi.
But on server USER_DISCONNECT is not trigged.

I think my approach may be wrong. But my requirement is, when there is a connection issue (internet issue or other connection issue), I need to capture this on smart fox server.

Please suggest a solution approach.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: USER_DISCONNECT

Postby Lapo » 22 Mar 2023, 09:15

Hi,
this is a common misconception... turning off the wifi will not shutdown your connection.
Sounds counterintuitive but it's how it works :)
You can read all the details here:
https://smartfoxserver.com/blog/what-re ... tworkwifi/

If there's anything else let us know.
Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Sreedhar_cd
Posts: 8
Joined: 22 Mar 2023, 08:37

Re: USER_DISCONNECT

Postby Sreedhar_cd » 23 Mar 2023, 13:40

Hi Lapo,
Thank you for the response. Now I am clear.

But , how can I noticed disconnection on my server. By using USER_DISCONNET , can I identify that a user is disconnected. Or is there any event can I user on server.

My requirement is, once a player disconnected (internet-failure, or force fully closed application) server need to notify to other users.
As of not iam able to notified if the player closed the application forcefully.

But not able to identify with other criteria i.e network disconnection. Please suggest a solution.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: USER_DISCONNECT

Postby Lapo » 24 Mar 2023, 10:47

Hi,
yes the DISCONNECTION event will tell you when a User has lost connection.
Also you can enable the HRC system, which is mentioned in the article I've linked, and which can quickly restore the state of a game if one or more players lost connection for a brief moment.

My requirement is, once a player disconnected (internet-failure, or force fully closed application) server need to notify to other users.
As of not iam able to notified if the player closed the application forcefully.


Sure. Just keep in mind that sometimes disconnections can not trigger immediately as they happen, for example in the case of pulling the ethernet cord from a computer or shutting down the WiFi abruptly. In those cases a disconnection will occur at a later time when the operating system of the devices recognize the inactivity of the client.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 49 guests