V
V
Vadim Stepanenko2018-03-26 18:05:59
PHP
Vadim Stepanenko, 2018-03-26 18:05:59

PHP console script?

Hello!
There is some implementation of websockets in php (implemented based on this ). Through this script, in addition to the chat, an online counter is displayed, as well as other "notifiers" for users.
Do I understand correctly that because PHP is not an asynchronous language, then if user 1 sent a request (for example, it will take 10 seconds), and after 2 seconds user 2 also sends a request, will it be processed only when the request from user 1 is ready?
Processing time - 10s took from the ceiling, so that the essence of the issue was clear

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Kirill Nesmeyanov, 2018-03-26
@SerafimArts

Do I understand correctly that because PHP is not an asynchronous language,

No, not right.
Depends on the implementation and the presence of blocking operations.
It is worth noting that it doesn't matter if the operations are synchronous or not - the amount of the total execution of requests will be identical (although in the case of asynchronous work even longer, because the overhead of switching contexts).
Faerie thrasher. No tests, nothing. Yes, and in the globals code. tin

A
Alj, 2018-03-27
@Alj

As already said, it depends on the implementation.
I can advise you to pay attention to https://github.com/walkor/Workerman (does not work under win), if there are 1 workers, then yes, the second user will wait, if 2, then no.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question