Build process output sending with swoole

31 Views Asked by At

I have a build page where the browser connects to the websocket server implemented in swoole using the websocket protocol. The way it currently works is that swoole runs a cli command, like this:

composer update >> build.log

and the swoole\Timer::tick solution reads the build.log file at certain intervals, and sends the current build output to the connected browser clients via websocket using the $server->push method.

How can this be implemented in a better way? I'm thinking that the build commands would not send their output to a file, and that file it wouldn't be polling by a swoole timer, but when the output happens in the build process, it would be get by the swoole via some event, and this data would be sent by the swoole to the connected clients.

0

There are 0 best solutions below