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?
Event User inactivity
-
- Posts: 14
- Joined: 09 May 2019, 17:24
Re: Event User inactivity
Hi,
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
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
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
-
- Posts: 14
- Joined: 09 May 2019, 17:24
Re: Event User inactivity
I was looking for "reason" parameter.
Thanks Lapo
Thanks Lapo
-
- Posts: 14
- Joined: 09 May 2019, 17:24
Re: Event User inactivity
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?
-
- Posts: 14
- Joined: 09 May 2019, 17:24
Re: Event User inactivity
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.
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.
-
- Posts: 1
- Joined: 19 Sep 2019, 06:56
Re: Event User inactivity
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
Who is online
Users browsing this forum: ppu-pro_nozy and 136 guests