From f2a3f22436ac524b13ffaa9d29a37fbebc7c047f Mon Sep 17 00:00:00 2001 From: leob Date: Sat, 19 Nov 2022 13:35:11 +0800 Subject: [PATCH 1/6] Small syntactic change which makes the code PHP 7.4 compatible --- src/ConnectionRepository.php | 6 ++++-- src/Handler.php | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ConnectionRepository.php b/src/ConnectionRepository.php index 5fe631b..44b0df9 100644 --- a/src/ConnectionRepository.php +++ b/src/ConnectionRepository.php @@ -4,16 +4,18 @@ use Aws\ApiGatewayManagementApi\ApiGatewayManagementApiClient; use Aws\ApiGatewayManagementApi\Exception\ApiGatewayManagementApiException; -use GuzzleHttp\Exception\ClientException; class ConnectionRepository { protected ApiGatewayManagementApiClient $apiGatewayManagementApiClient; + protected SubscriptionRepository $subscriptionRepository; public function __construct( - protected SubscriptionRepository $subscriptionRepository, + SubscriptionRepository $subscriptionRepository, array $config ) { + $this->subscriptionRepository = $subscriptionRepository; + $this->apiGatewayManagementApiClient = new ApiGatewayManagementApiClient(array_merge($config['connection'], [ 'version' => '2018-11-29', 'endpoint' => "https://{$config['api']['id']}.execute-api.{$config['connection']['region']}.amazonaws.com/{$config['api']['stage']}/", diff --git a/src/Handler.php b/src/Handler.php index 1517fb7..d0708db 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -13,9 +13,12 @@ class Handler extends WebsocketHandler { + protected SubscriptionRepository $subscriptionRepository; + protected ConnectionRepository $connectionRepository; + public function __construct( - protected SubscriptionRepository $subscriptionRepository, - protected ConnectionRepository $connectionRepository + SubscriptionRepository $subscriptionRepository, + ConnectionRepository $connectionRepository ) { $this->subscriptionRepository = $subscriptionRepository; $this->connectionRepository = $connectionRepository; From 8c1abfe2ca9dc3b376c67ebca2b410b8b631debe Mon Sep 17 00:00:00 2001 From: leob Date: Sun, 21 May 2023 12:24:57 +0800 Subject: [PATCH 2/6] updated composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 4d98344..1c11785 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "georgeboot/laravel-echo-api-gateway", + "name": "leob/laravel-echo-api-gateway", "description": "Use Laravel Echo with API Gateway Websockets", "keywords": [ "laravel", @@ -19,7 +19,7 @@ } ], "require": { - "php": "^8.0", + "php": "^7.4", "ext-json": "*", "aws/aws-sdk-php": "^3.80", "bref/bref": "^1.1", From f8c5728d0fe30cc4da04072e6a04397e9572ecd9 Mon Sep 17 00:00:00 2001 From: leob Date: Wed, 6 Sep 2023 14:58:24 +0800 Subject: [PATCH 3/6] updated composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1c11785..eb152a8 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require": { "php": "^7.4", "ext-json": "*", - "aws/aws-sdk-php": "^3.80", + "aws/aws-sdk-php": "^3.235", "bref/bref": "^1.1", "guzzlehttp/guzzle": "^6.3|^7.0", "laravel/framework": "^6.0|^7.0|^8.0|^9.0" From cff952b31397c4c9f42ec8a271671b3620686aee Mon Sep 17 00:00:00 2001 From: leob Date: Wed, 6 Sep 2023 15:12:12 +0800 Subject: [PATCH 4/6] don't pass 'token' to the AWS client --- config/laravel-echo-api-gateway.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/laravel-echo-api-gateway.php b/config/laravel-echo-api-gateway.php index 68047b9..e6bb9dd 100644 --- a/config/laravel-echo-api-gateway.php +++ b/config/laravel-echo-api-gateway.php @@ -5,7 +5,7 @@ 'connection' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'token' => env('AWS_SESSION_TOKEN'), + // 'token' => env('AWS_SESSION_TOKEN'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], From 00451df0c7dd142803402daa159dfebfaaafc777 Mon Sep 17 00:00:00 2001 From: leob Date: Wed, 6 Sep 2023 19:32:09 +0800 Subject: [PATCH 5/6] reverted changes from the previous two commits, as websockets were now broken on AWS --- composer.json | 2 +- config/laravel-echo-api-gateway.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index eb152a8..1c11785 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "require": { "php": "^7.4", "ext-json": "*", - "aws/aws-sdk-php": "^3.235", + "aws/aws-sdk-php": "^3.80", "bref/bref": "^1.1", "guzzlehttp/guzzle": "^6.3|^7.0", "laravel/framework": "^6.0|^7.0|^8.0|^9.0" diff --git a/config/laravel-echo-api-gateway.php b/config/laravel-echo-api-gateway.php index e6bb9dd..68047b9 100644 --- a/config/laravel-echo-api-gateway.php +++ b/config/laravel-echo-api-gateway.php @@ -5,7 +5,7 @@ 'connection' => [ 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), - // 'token' => env('AWS_SESSION_TOKEN'), + 'token' => env('AWS_SESSION_TOKEN'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], From c8742539c3c1397bab99532244e2d2f4b6ff0e03 Mon Sep 17 00:00:00 2001 From: leob Date: Fri, 2 Feb 2024 15:26:49 +0800 Subject: [PATCH 6/6] added PHP 8.x to the supported PHP versions in composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1c11785..597c14a 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ } ], "require": { - "php": "^7.4", + "php": "^7.3|^8.0", "ext-json": "*", "aws/aws-sdk-php": "^3.80", "bref/bref": "^1.1",