Wednesday 15 July 2015

php - Ratchet send doesn't work with sleep function -


Send shaft does not work with the sleep function, how can I fix it?

Here's my code:

  $ i = 0; While ($ i & lt; 180) {foreach ($ this-> clients as $ client) {$ client- & gt; Send ($ res-> asXML (). "\ 0"); } Sleep (2); $ I ++; } Sleeping with shaft is not a good idea.    

I am not sure what you are trying to accomplish, but this is a basic example. I am ready to bet that you will need to work your code again to adjust this technique.

  // server $ server = IoServer :: factory (new WsServer ($ session), $ port, $ ADR); // loop $ server-> Loop-> Adapter timer (2, function) ($ client- & gt; send ($ res-> asXML). "\ 0");});   

Source:



No comments:

Post a Comment