Closed AndeYashwanth closed 4 years ago
The call to socket_select() has the timeout intentionally set to 1 second. The call is on line 89, with the call to the tick() method shortly before that.
(Note for future versions: Let users configure this.)
This means that socket_select() will block and wait for a new message of any type for 1 second. If a message comes in sooner, that message will be processed, anything that you put into your tick() method will run, and socket_select() will be called again. If any messages came in while the rest of the script was working, that message will be picked up as soon as socket_select() is called; otherwise it will wait for up to a second again.
On Sat, Jun 6, 2020 at 11:00 AM Ande Yashwanth notifications@github.com wrote:
In websockets.php how does the function tick() execute every second? Is it accidental that the tick() method happens to be executing approx once every second or it is intentional?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ghedipunk/PHP-Websockets/issues/130, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB46PVAYH5RW5ER4B4ZJILRVJYZTANCNFSM4NWFPMPA .
In websockets.php how does the function tick() execute every second? Is it accidental that the tick() method happens to be executing approx once every second or it is intentional?