Event User inactivity

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

Moderators: Lapo, Bax

italianRichy
Posts: 14
Joined: 09 May 2019, 17:24

Event User inactivity

Postby italianRichy » 21 Aug 2019, 13:22

Hi world,
I am setting user inactivity in my project, when a user is logged out for inactivity, or if he logged out closing the app, the event generated on the server is always the same.
How can I send the client who was disconnected for inactivity?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Event User inactivity

Postby Lapo » 21 Aug 2019, 16:39

Hi,
I am setting user inactivity in my project, when a user is logged out for inactivity, or if he logged out closing the app, the event generated on the server is always the same.

Yes. A user is disconnected when inactive for a time longer than what is configured, therefore you will get a USER_DISCONNECT event, which is the same event you get if the player closed the game. However the event also provides a "reason" parameter that tells you one of several causes of the disconnection (I am referring to a server side event, to be clear). You can check the details here:
http://docs2x.smartfoxserver.com/api-do ... DISCONNECT

How can I send the client who was disconnected for inactivity?

I don't understand the question. You can't send messages to a client that was disconnected for inactivity. When you receive the event the User is already gone, so there's no way to communicate any more.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
italianRichy
Posts: 14
Joined: 09 May 2019, 17:24

Re: Event User inactivity

Postby italianRichy » 22 Aug 2019, 00:44

I was looking for "reason" parameter.

Thanks Lapo
italianRichy
Posts: 14
Joined: 09 May 2019, 17:24

Re: Event User inactivity

Postby italianRichy » 22 Aug 2019, 11:30

I found the Disconnect_Reason event, but if the user at the time of this event is disconnected, how can I notify him that he was kicked for inactivity?
italianRichy
Posts: 14
Joined: 09 May 2019, 17:24

Re: Event User inactivity

Postby italianRichy » 22 Aug 2019, 11:43

I found how to do it:
The client receives a lost connection event, when I receive it I check the "reason" parameter, so this parameter in addition to the server can also be controlled on the client side.

Thanks SmartFox2x for existing !!
I hope this comment will help someone else in the future.
mcrobertg7
Posts: 1
Joined: 19 Sep 2019, 06:56

Re: Event User inactivity

Postby mcrobertg7 » 19 Sep 2019, 07:13

italianRichy wrote:I found how to do it:
The client receives a lost connection event, when I receive it I check the "reason" parameter, so this parameter in addition to the server can also be controlled on the client side.
Thanks SmartFox2x for existing !!
I hope this comment will help someone else in the future.
JerryHayes


Do you mean

Code: Select all

SFSEvent.CONNECTION_LOST
fired from client? So what do you get from client trace?

Return to “SFS2X Questions”

Who is online

Users browsing this forum: ppu-pro_nozy and 136 guests