H
H
Hello World2021-09-20 11:33:38
JavaScript
Hello World, 2021-09-20 11:33:38

How to save socket.id to database?

Hello!
I’ll say right away that I’m a Frontend-er, so I don’t need to criticize much, I’m just interested in this topic =) The
question is this: as I understand it, when a client connects to the server, the connection event is generated in the Backend, where the socket object comes as a callback parameter , each socket has its own unique identifier (id) by which you can "contact" with another connected client. I got interested and I'm trying to make a chat application, and I'm wondering how can I store the socket.id in the database, so that later I can somehow find the user using it?
The problem is that, with each connection, this socket id changes (

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question