S
S
Sedbol2020-01-08 15:11:35
Node.js
Sedbol, 2020-01-08 15:11:35

How to check user is online or not Websocket?

When connecting, I assign an id to each user
ws.onclient=userId;
. How can I check if the user is online or not? If not online return for example not online.

wss.clients.forEach(function each(client) {
                       if (client.onclient === userId) {
                           console.log('Онлаин')
                       }
                   });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2020-01-08
@Sedbol

Client event listener: network, batch activity, UI timers in batches.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question