receive()) { echo "Received $payload".PHP_EOL; } echo "Closed connection".PHP_EOL; }; $channel = connect(sys_get_temp_dir().'/test'); $thread = async($clientHandler, $channel); $channel->send('ping'); $thread->await();