Answer the question
In order to leave comments, you need to log in
Why is websocket php taking a very long time to complete a request?
Hello! I use this socket chat on the site. There was a need to save each message in the database. As a result, in the server.php file, in the loop where it checks for new messages in the chat (line 46) on the github in server.php, I connected redbean.php via require_once, and then the usual construction for adding an entry to the database:
$add2Db = R::dispense('chatmes');
$add2Db->reg_data = time();
$add2Db->username = $user_name;
$add2Db->message = $user_message;
R::store($add2Db);
Answer the question
In order to leave comments, you need to log in
1. What prevents that library from being connected 1 time at the beginning of the script?
2. Supplement the code with the collection of timestamps - so it will immediately become clear what specifically slows down
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question