markdown guide

Can you provide more detail on the intended use case?

Is this for analytics purposes? For something like a chat application where you need to show online status? Something else entirely?

The potential solution would depend on those details.


It is mosly about a chat. Because i intended to add the chat option later. Right now i just want to list online users in time table that they are online. Thank you for your comment. 🤗


Ok, there are probably better ways to do it,but one option would be to have a last_seen column in your accounts table and update that using an after_action in your ApplicationController.

Then only show people as active if they have been seen in the last N minutes. To make this more accurate, you may also want to track whether accounts are logged in, so that as soon as someone logs out it automatically shows them as not online.

I'm not super familiar with how websockets work, but you might be able to get a more accurate result by actually doing a ping of some sort between the client and the server to check connection status, but perhaps others may be able to give you more details on that.


This is something I'm planning on practicing pretty soon. I would go with ActionCable, streaming the user status, as proposed in this paid tutorial: gumroad.com/l/lNEhE

P.S.: I'm NOT the author, I'm NOT getting any financial incentive to refer this tutorial. I just found it a couple of days ago on Reddit and decided to buy it for the future.

Classic DEV Post from Nov 14 '19

Share your CSS knowledge

Ardit Daku profile image
I am a developer. Looking to expand my knowledge and experience professionally and create new connections.

Hey there reader...

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❤️