@@ -19,7 +19,7 @@ class Pusher implements LoggerAwareInterface, PusherInterface
1919 /**
2020 * @var string Version
2121 */
22- public static $ VERSION = '7.2.3 ' ;
22+ public static $ VERSION = '7.2.4 ' ;
2323
2424 /**
2525 * @var null|PusherCrypto
@@ -64,12 +64,6 @@ public function __construct(string $auth_key, string $secret, string $app_id, ar
6464 {
6565 $ this ->check_compatibility ();
6666
67- if (!is_null ($ client )) {
68- $ this ->client = $ client ;
69- } else {
70- $ this ->client = new \GuzzleHttp \Client ();
71- }
72-
7367 $ useTLS = true ;
7468 if (isset ($ options ['useTLS ' ])) {
7569 $ useTLS = $ options ['useTLS ' ] === true ;
@@ -119,6 +113,13 @@ public function __construct(string $auth_key, string $secret, string $app_id, ar
119113 );
120114 $ this ->crypto = new PusherCrypto ($ parsedKey );
121115 }
116+
117+
118+ if (!is_null ($ client )) {
119+ $ this ->client = $ client ;
120+ } else {
121+ $ this ->client = new \GuzzleHttp \Client (['timeout ' => $ this ->settings ['timeout ' ],]);
122+ }
122123 }
123124
124125 /**
@@ -724,7 +725,8 @@ public function get(string $path, array $params = [], $associative = false)
724725 'query ' => $ signature ,
725726 'http_errors ' => false ,
726727 'headers ' => $ headers ,
727- 'base_uri ' => $ this ->channels_url_prefix ()
728+ 'base_uri ' => $ this ->channels_url_prefix (),
729+ 'timeout ' => $ this ->settings ['timeout ' ]
728730 ]);
729731
730732 $ status = $ response ->getStatusCode ();
@@ -776,7 +778,8 @@ public function post(string $path, $body, array $params = [])
776778 'body ' => $ body ,
777779 'http_errors ' => false ,
778780 'headers ' => $ headers ,
779- 'base_uri ' => $ this ->channels_url_prefix ()
781+ 'base_uri ' => $ this ->channels_url_prefix (),
782+ 'timeout ' => $ this ->settings ['timeout ' ]
780783 ]);
781784 } catch (ConnectException $ e ) {
782785 throw new ApiErrorException ($ e ->getMessage ());
@@ -826,7 +829,8 @@ public function postAsync(string $path, $body, array $params = []): PromiseInter
826829 'body ' => $ body ,
827830 'http_errors ' => false ,
828831 'headers ' => $ headers ,
829- 'base_uri ' => $ this ->channels_url_prefix ()
832+ 'base_uri ' => $ this ->channels_url_prefix (),
833+ 'timeout ' => $ this ->settings ['timeout ' ],
830834 ])->then (function ($ response ) {
831835 $ status = $ response ->getStatusCode ();
832836
0 commit comments