user image

Rakshit
Published in : 2022-02-27

How chat mechanism works? when user comes online, How can I show green dot for that user?

Angular

The requirement is about adding chat functionality in my freelancing Angular project, 

Scenario:

How do I create a logic to detect when the user opened the website and logs in to the dashboard?

Once the user is accessing pages on the website, Can I detect him online somehow? How do I show the green icon (saying, the user is online right now)?

When user logs off or directly closes the window, it should say the user was online before X minutes, where X will be the number of minutes or hours.

My trial & error efforts:

I checked is-online package from npm. But it is not working as expected. When the user directly closes the browser, it still shows that the user is online, even after 5-10 minutes! which is not detecting the state of the user (Active or Inactive) accurately.

Can someone guide me on how do I create such logic?

 

Update 21-FEB-2023 : 

Found solution here: Medium

Comments

There is no comments yet

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Angular - PrimeNG charts adding colors for each legends dynamically
Publish date: 2022-02-27 | Comments: 1

Tag: Angular

In Angular project, RxJS isStopped is deprecated! What is the alternative?
Publish date: 2022-02-28 | Comments: 1

Tag: Angular

How to calculate distance between two Bluetooth devices?
Publish date: 2022-02-26 | Comments: 1

Tag: Angular

How to bind Weekends off to my kendo calendar in Angular?
Publish date: 2022-03-11 | Comments: 2

Tag: Angular

How to call event handler onload for Angular application?
Publish date: 2022-03-02 | Comments: 2

Tag: Angular