WEBSOCKET and PHP data storage

Asked

Viewed 122 times

0

I came across a question, I have a Websockets server written in PHP and need to store information that the user sends to the server, and that this data can be recovered only by the current session between the user and server.

I thought about SESSIONS but I think it’s not a good choice, what the solution?

1 answer

1

Depending on the amount of information, using Sesssions may not be the best idea. If you want an alternative, you can save it to the database with the current session id as a reference (session_id) or a unique number saved in $_SESSION, as an example, $user_id + time().

id | id_sessao | info1 | info2 | ...
 1 |    234234 |   ... |   ... | ...
 2 |    345354 |   ... |   ... | ...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.