{"action":"created","issue":{"url":"https://api.github.com/repos/php-amqplib/php-amqplib/issues/67","repository_url":"https://api.github.com/repos/php-amqplib/php-amqplib","labels_url":"https://api.github.com/repos/php-amqplib/php-amqplib/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/php-amqplib/php-amqplib/issues/67/comments","events_url":"https://api.github.com/repos/php-amqplib/php-amqplib/issues/67/events","html_url":"https://github.com/php-amqplib/php-amqplib/issues/67","id":10448071,"number":67,"title":"Reconsider non_blocking option of Channel::wait()","user":{"login":"m00t","id":301661,"avatar_url":"https://avatars.githubusercontent.com/u/301661?v=3","gravatar_id":"","url":"https://api.github.com/users/m00t","html_url":"https://github.com/m00t","followers_url":"https://api.github.com/users/m00t/followers","following_url":"https://api.github.com/users/m00t/following{/other_user}","gists_url":"https://api.github.com/users/m00t/gists{/gist_id}","starred_url":"https://api.github.com/users/m00t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m00t/subscriptions","organizations_url":"https://api.github.com/users/m00t/orgs","repos_url":"https://api.github.com/users/m00t/repos","events_url":"https://api.github.com/users/m00t/events{/privacy}","received_events_url":"https://api.github.com/users/m00t/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2013-01-30T07:00:23Z","updated_at":"2016-03-15T14:54:35Z","closed_at":"2015-02-09T17:29:12Z","body":"This option seems to be useless now, because actually blocking read is performed. Now with this option enabled wait() will return after something is received, not only when one of allowed methods is received. But if there is not data in the sockets, wait will not return ever even with this option enabled. IMO it is not an expected behaviour. \r\n\r\nThis option is introdiced here: https://github.com/videlalvaro/php-amqplib/pull/11/files, but it is not even used in new non_blocking example. Seems like it is refuse from unsuccessful experiment"},"comment":{"url":"https://api.github.com/repos/php-amqplib/php-amqplib/issues/comments/196855462","html_url":"https://github.com/php-amqplib/php-amqplib/issues/67#issuecomment-196855462","issue_url":"https://api.github.com/repos/php-amqplib/php-amqplib/issues/67","id":196855462,"user":{"login":"JostBaron","id":2916594,"avatar_url":"https://avatars.githubusercontent.com/u/2916594?v=3","gravatar_id":"","url":"https://api.github.com/users/JostBaron","html_url":"https://github.com/JostBaron","followers_url":"https://api.github.com/users/JostBaron/followers","following_url":"https://api.github.com/users/JostBaron/following{/other_user}","gists_url":"https://api.github.com/users/JostBaron/gists{/gist_id}","starred_url":"https://api.github.com/users/JostBaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JostBaron/subscriptions","organizations_url":"https://api.github.com/users/JostBaron/orgs","repos_url":"https://api.github.com/users/JostBaron/repos","events_url":"https://api.github.com/users/JostBaron/events{/privacy}","received_events_url":"https://api.github.com/users/JostBaron/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T14:54:35Z","updated_at":"2016-03-15T14:54:35Z","body":"I've found out how one can handle multiple connections at the same time:\r\n\r\n        $sockets = [];\r\n        foreach ($this->allAmqpChannels as $channel) {\r\n            $sockets[] = $channel->getConnection()->getSocket();\r\n        }\r\n\r\n        echo \"Number sockets: \" . count($sockets) . \"\\n\";\r\n\r\n        while (true) {\r\n            $readSockets = $sockets;\r\n            $writeSockets = null;\r\n            $exceptSockets = null;\r\n\r\n            echo \"Waiting for socket change...\\n\";\r\n\r\n            if (false === ($numberChangedSockets = stream_select($readSockets, $writeSockets, $exceptSockets, null))) {\r\n                echo \"An error occurred while waiting for something to occurr on the queues.\\n\";\r\n            } elseif ($numberChangedSockets > 0) {\r\n                // Something arrived on a socket, check all channels for a new message.\r\n                // Do so in a non-blocking way!\r\n                foreach ($this->allAmqpChannels as $channel) {\r\n\r\n                    if (in_array($channel->getConnection()->getSocket(), $readSockets, true)) {\r\n\r\n                        // This is non-blocking, since there is data ready on the socket for this channel.\r\n                        echo \"\\nGetting message\\n\";\r\n                        $channel->wait();\r\n                    }\r\n                }\r\n            }\r\n        }"}}