DEV Community


Discussion on: How to Build a Real-time Chat App With NodeJS, Socket.IO, and MongoDB

prashant1k99 profile image
Prashant Singh

Does anybody knows how to setup friend online indicator for chat app?

ezesunday profile image
Eze Sunday Eze Author

You can start with the suggestion:

It's not straight forward though. different browsers implement this differently.

But you can do two things, use the offlineOnline browser api here

Ping a website you are sure will always be available such as Google in a http request. You can broadcast same event to other members saying the user is offline. That's it.