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?

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

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

Tag: Angular

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

Tag: Angular

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

Tag: Angular

Adding country flags is really struggling thing?
Publish date: 2022-02-25 | Comments: 6

Tag: Angular

How to reload Angular component without refreshing page?
Publish date: 2022-03-02 | Comments: 1

Tag: Angular

How to translate Angular application easily?
Publish date: 2022-03-03 | Comments: 2

Tag: Angular

Static code analysis tools integration with latest Angular version
Publish date: 2022-02-25 | Comments: 1

Tag: Angular