Reputation: 1
I have an education app that written by node.js and express.js I want to show user status(online or offline) side profile photo How can do it???
Upvotes: 0
Views: 889
Reputation: 268
Using socket.io
is a good choice here: https://socket.io
.
Once a user logs in successfully, you can emit
an event to broadcast to everybody else that he is online
. Similarly, when the user logs out, you can emit
another event to broadcast to everybody else that he went offline
. (Also when he closes the browser without logging out properly).
Using socketio
you can emit
and listen to events between the client and the server. You can broadcast events to multiple clients, you can add clients to rooms
and broadcast events specifically to the clients in the room, and do a whole lot of things!
Good luck.
Upvotes: 1