PHP Swoole websocket coroutine notification server

I made coroutine-based WebSocket server https://wiki.swoole.com/en/#/coroutine/ws_server
And now i want create a notification service. While websocket server has any connected clients it check some data in DB and than send that info to clients.
But if i add some like that:

          while (!!$wsObjects) {
              sleep(1);
              $ws->push(json_encode($stmt->fetchAll()));
            }

loop stay infinite and i can`t close any connections https://wiki.swoole.com/en/#/getting_started/notice?id=the-impact-of-while-loop

How can i made notification service with swoole websocket coroutine notification server?