Socket Identify

I have a few questions about the Socket Identify:

  1. What format is the ID value? If you store the user’s socket ID in a database, what format is the best field to use?
  2. Do I understand correctly, if several Socket components are installed on the client side, then each socket will have its own ID?
  3. The probability that the socket IDs of different users will match is excluded?
  4. The socket ID of the same user changes from session to session, or will it always be the same?

We had the same topic the other day.
The following may help you:

Socket identify returns the socket ID. Each connection is assigned to a random 20-characters identifier.
It can look like this (ojIckSD2jqNzOqIrAGzL).
This ID is synchronised between the client and server instance and is assigned automatically. In the socket manager of the server instance you can generate your own IDs and send them in the handshake packet, but Wappler does not have this integrated. This would have to be created manually.

If the socket connections are for the same room, only one connection should be established. In other words, a socket client instance represents only one connection to the service instance. (but we are not quite sure about that either :slight_smile: )

Since the IDs are assigned randomly, there is a chance of two identical IDs. But the chance is very small. If you don’t have millions of socket connections, this shouldn’t be a problem.

Yep, the socket ID changes with every reconnection from client. Unless of course you assign a fixed socket ID via the manager instance. has a really good documentation.
Here you can find details about the server socket instances:

And here about the client side:

1 Like

Hello @Masterchief. This topic was created when I was just starting to learn sockets. At the moment, all questions about them are closed and they have been successfully implemented in many of my projects. However, thank you for leaving your comment here. :+1: This can help all those who have not worked with sockets yet and they may have the same questions.