J
J
jenya77712018-11-18 21:11:13
PostgreSQL
jenya7771, 2018-11-18 21:11:13

How to implement the last time online function?

Hello, I am making a site on nodeJs and postgresql, I use sessions for authorization and Redis cache storage. How can I implement the function when the user was last online?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Laud, 2018-11-18
@kshshe

With each action / authorization / something else of the user, write down in the database that he was online. You can then use this information wherever you need it.

A
Alexey, 2018-11-18
@Azperin

Create a last_seen column and add a timestamp there when requesting session initialization.

I
Ivan Shumov, 2018-11-18
@inoise

Make a websocket in which the online label is reset on the first connection, and when the connection is lost and there are no other active ones, the last activity label is put

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question