{"action":"created","issue":{"url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/80","labels_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/80/comments","events_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/80/events","html_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/80","id":121137820,"number":80,"title":"Timeout and connection timeout setting ability added","user":{"login":"ihoru","id":361908,"avatar_url":"https://avatars.githubusercontent.com/u/361908?v=3","gravatar_id":"","url":"https://api.github.com/users/ihoru","html_url":"https://github.com/ihoru","followers_url":"https://api.github.com/users/ihoru/followers","following_url":"https://api.github.com/users/ihoru/following{/other_user}","gists_url":"https://api.github.com/users/ihoru/gists{/gist_id}","starred_url":"https://api.github.com/users/ihoru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihoru/subscriptions","organizations_url":"https://api.github.com/users/ihoru/orgs","repos_url":"https://api.github.com/users/ihoru/repos","events_url":"https://api.github.com/users/ihoru/events{/privacy}","received_events_url":"https://api.github.com/users/ihoru/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-09T01:06:41Z","updated_at":"2015-12-09T13:28:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/pulls/80","html_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/80","diff_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/80.diff","patch_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/80.patch"},"body":"As I wrote in Gitter chat here are changes to give developer ability to pass request timeout to the HttpClient.\r\n\r\n1. How to use it?\r\nIn every method that makes request (getUpdates, sendVideo, sendMessage and all other) you can pass params: http_client_timeout and http_client_connect_timeout like here:\r\n```\r\n...->sendMessage(\r\n            [\r\n                'chat_id'                     => $chatId,\r\n                'text'                        => $text,\r\n                'http_client_timeout'         => 1,\r\n                'http_client_connect_timeout' => 1,\r\n            ]\r\n        );\r\n```\r\n2. In process of working on this changes I decided also to give ability to change connect_timeout (it also was constant in GuzzleHttpClient class)\r\n3. I added $connectTimeOut variable to the end of send method for backward compatibility.\r\n4. I created class TestGuzzleHttpClient that extends GuzzleHttpClient just for getting passed timeouts and check them in tests. I'm not sure in correct place of the file (I though to put it into tests dir, but there is just mocks now and no src or something like that...)\r\n5. I created tests for this ability"},"comment":{"url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/comments/163231481","html_url":"https://github.com/irazasyed/telegram-bot-sdk/pull/80#issuecomment-163231481","issue_url":"https://api.github.com/repos/irazasyed/telegram-bot-sdk/issues/80","id":163231481,"user":{"login":"jonnywilliamson","id":2513663,"avatar_url":"https://avatars.githubusercontent.com/u/2513663?v=3","gravatar_id":"","url":"https://api.github.com/users/jonnywilliamson","html_url":"https://github.com/jonnywilliamson","followers_url":"https://api.github.com/users/jonnywilliamson/followers","following_url":"https://api.github.com/users/jonnywilliamson/following{/other_user}","gists_url":"https://api.github.com/users/jonnywilliamson/gists{/gist_id}","starred_url":"https://api.github.com/users/jonnywilliamson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonnywilliamson/subscriptions","organizations_url":"https://api.github.com/users/jonnywilliamson/orgs","repos_url":"https://api.github.com/users/jonnywilliamson/repos","events_url":"https://api.github.com/users/jonnywilliamson/events{/privacy}","received_events_url":"https://api.github.com/users/jonnywilliamson/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T13:28:21Z","updated_at":"2015-12-09T13:28:21Z","body":"I don't like this implementation.\r\n\r\nWe are added non-documented (as per Telegram API docs) parameters to the all the methods.\r\n\r\nWhy is this not an option that can be assigned to the Guzzle client directly instead?\r\nSomething like:\r\n`$this->api->client->setHttpTimeout($value)`\r\n\r\nIMO this has no reason being added to the API methods."}}