lindleycb / meteor-stale-session

Stale session and session timeout handling for meteorjs
MIT License
40 stars 20 forks source link

detecting activity on touch screen mobile device - comparable to mouse movement? #8

Open wesyah234 opened 9 years ago

wesyah234 commented 9 years ago

On a desktop, this package will detect mouse movement... is there any way to detect similar activity on a mobile device, ie, finger swipes of the page?... If a user is active, but not clicking buttons that cause meteor activity, It is timing out, but the same thing on a desktop would have mouse movement and thus would not time out...

AdamBrodzinski commented 9 years ago

You should be able to use the touchstart event to trigger an activity. This should fire on the start of a drag/scroll. I think Meteor as of 0.6 supports tap events as well (not positive).

So in your meteor config file you could do this:

{
  "public": {
    "staleSessionActivityEvents": "touchstart touchend mousemove click keydown"
  }
}
wesyah234 commented 9 years ago

Awesome, thank you, that's what I needed! Any thoughts on detecting when the user is scrolling the sreen up and down? Basically, I'm looking for detecting any finger movement on the screen, as that would indicate the user is still around. Pressing and dragging the window up and down should be considered activity... although, now that I think of it, on a desktop, that would be equivalent to scrolling the scrollbar, which isn't probably triggering any mouse events...