what efficient way count online users in ror application uses devise?
i considering adding field called status
users table , update according several situations. best practice subject?
in theory can't plainly in server side.
the server stateless. visitor request something, server gives it, bye bye, nothing more.
then how "online" solutions google analytice work?
the basic is, visitor block of js code run on browser, downloaded either server or google's server. js code send requests server @ time interval claim visitor still "online".
if after time there no such request visitor, "offline".
the js code may send request server ask updating view of visitors status, visitors can see other visitors "online".
if implemented on own server, solution may bit complex , require more efficient storage such redis or realtime solutions. have not researched such gems before, can check if exists in analytic category.
if want simple solution, last visitors 1 mentioned zolter, or public activities gem may fit you.