{"action":"created","issue":{"url":"https://api.github.com/repos/clue/php-ami-react/issues/31","repository_url":"https://api.github.com/repos/clue/php-ami-react","labels_url":"https://api.github.com/repos/clue/php-ami-react/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/clue/php-ami-react/issues/31/comments","events_url":"https://api.github.com/repos/clue/php-ami-react/issues/31/events","html_url":"https://github.com/clue/php-ami-react/issues/31","id":170447011,"number":31,"title":"Connection closed","user":{"login":"nekulin","id":819130,"avatar_url":"https://avatars.githubusercontent.com/u/819130?v=3","gravatar_id":"","url":"https://api.github.com/users/nekulin","html_url":"https://github.com/nekulin","followers_url":"https://api.github.com/users/nekulin/followers","following_url":"https://api.github.com/users/nekulin/following{/other_user}","gists_url":"https://api.github.com/users/nekulin/gists{/gist_id}","starred_url":"https://api.github.com/users/nekulin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nekulin/subscriptions","organizations_url":"https://api.github.com/users/nekulin/orgs","repos_url":"https://api.github.com/users/nekulin/repos","events_url":"https://api.github.com/users/nekulin/events{/privacy}","received_events_url":"https://api.github.com/users/nekulin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-10T15:30:56Z","updated_at":"2016-08-10T15:35:49Z","closed_at":null,"body":"\t$loop = \\React\\EventLoop\\Factory::create();\r\n\t$factory = new Factory($loop);\r\n\t$factory->createClient($target)->then(\r\n\t    function (Client $client) use ($loop) {\r\n\t\techo 'Client connected ' . PHP_EOL;\r\n\t\t$sender = new ActionSender($client);\r\n\t\t$sender->events(true);\r\n\t\t$client->on('close', function() {\r\n\t\t    echo 'Connection closed' . PHP_EOL;\r\n\t\t});\r\n\t\t$client->on('event', function (Event $event) {\r\n\t\t    echo 'Event: ' . $event->getName() . ': ' . json_encode($event->getFields()) . PHP_EOL;\r\n\t\t});\r\n\t    },\r\n\t    function (\\Exception $error) {\r\n\t\techo 'Connection error: ' . $error;\r\n\t    }\r\n\t);\r\n\t$loop->run();\r\n\r\nPerform and immediately closes the connection:\r\n\r\nClient connected \r\nConnection closed\r\n"},"comment":{"url":"https://api.github.com/repos/clue/php-ami-react/issues/comments/238906270","html_url":"https://github.com/clue/php-ami-react/issues/31#issuecomment-238906270","issue_url":"https://api.github.com/repos/clue/php-ami-react/issues/31","id":238906270,"user":{"login":"nekulin","id":819130,"avatar_url":"https://avatars.githubusercontent.com/u/819130?v=3","gravatar_id":"","url":"https://api.github.com/users/nekulin","html_url":"https://github.com/nekulin","followers_url":"https://api.github.com/users/nekulin/followers","following_url":"https://api.github.com/users/nekulin/following{/other_user}","gists_url":"https://api.github.com/users/nekulin/gists{/gist_id}","starred_url":"https://api.github.com/users/nekulin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nekulin/subscriptions","organizations_url":"https://api.github.com/users/nekulin/orgs","repos_url":"https://api.github.com/users/nekulin/repos","events_url":"https://api.github.com/users/nekulin/events{/privacy}","received_events_url":"https://api.github.com/users/nekulin/received_events","type":"User","site_admin":false},"created_at":"2016-08-10T15:35:49Z","updated_at":"2016-08-10T15:35:49Z","body":"\t$loop = \\React\\EventLoop\\Factory::create();\r\n\t$factory = new Factory($loop);\r\n\t$factory->createClient($target)->then(\r\n\t\tfunction (Client $client) use ($loop) {\r\n\t\techo 'Client connected ' . PHP_EOL;\r\n\r\n\t\t$client->on('close', function() {\r\n\t\t    echo 'Connection closed' . PHP_EOL;\r\n\t\t});\r\n\t\t$client->on('event', function (Event $event) {\r\n\t\t    //echo 'Event: ' . $event->getName() . ': ' . json_encode($event->getFields()) . PHP_EOL;\r\n\t\t});\r\n\t\t},\r\n\t\tfunction (\\Exception $error) {\r\n\t\techo 'Connection error: ' . $error;\r\n\t\t}\r\n\t);\r\n\t$loop->run();\r\n\r\nIt works, but when the event comes, the connection is closed!"}}
{"actor":{"display_login":"nekulin"}}