copleykj / socialize-user-presence

Simple, scalable package to help your app keep track of your users online status.
MIT License
19 stars 9 forks source link

[Question] When is idle status activated? #23

Closed diavrank closed 3 years ago

diavrank commented 3 years ago

Hello Kelly, I was reading the server API and I wonder in which cases idle status can be enabled?

I saw that exists a method Meteor.user().setStatusIdle() , however, I have doubt if also exists a default timeout to detect inactivity of the user and enable idle status automatically.

it happens that I have a monitoring application and I am getting a weird behavior, since devices (users) are disconnected after the 3rd or 5th day. In some cases, they're reconnected automatically (this is good) but in other cases they remain offline.

image

In the monitoring view I am only using two status: online and offline, if online property is true then the icon is green, otherwise is red. So, I am suspecting if "idle" is active in those cases, that is the possible reason they keep in red, so that's why my question.

On the other hand, I wonder if you have had a similar situation of this:

I am getting a weird behavior, since devices (users) are disconnected after the 3rd or 5th day.

Notes:

Server:

Client:

Front-end of web admin is using Vue since they are real users who operate the system.

copleykj commented 3 years ago

This is very strange and I have not experienced this issue. I don't believe that the idle status should be a factor that would cause this, especially since you never explicitly call the setStatusIdle() method and therefore the status should never be in an "idle' state.

The only thing I can think of is that it has something to do with the ddp implementation of the simpleddp package. One thing that you might try just to see if it resolves the issue is to switch simpleddp to @socialize/react-native-meteor. You'll have to forgive the name as it can be confusing since the code has been refactored to support environments outside react-native and should work just about anywhere.

diavrank commented 3 years ago

Thank you for your feedback Kelly, I was doing some more tests and it seems to be something related to the simpleddp package since when the PC reaches a state of hibernation or sleep, then it doesn't update the ddp connection status, however, in the server logs it does be visible that session is disconnected for that client (I used UserPresence.onSessionDisconnected to see that part)

So, as an alternative solution I programmed a cron to reset the client each certain time.