Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EchoBroadcaster.php #2623

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/Subscriptions/Broadcasters/EchoBroadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Nuwave\Lighthouse\Subscriptions\Contracts\Broadcaster;
use Nuwave\Lighthouse\Subscriptions\Events\EchoSubscriptionEvent;
use Nuwave\Lighthouse\Subscriptions\Subscriber;
use Illuminate\Support\Facades\Broadcast;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://github.com/nuwave/lighthouse/blob/master/CONTRIBUTING.md#laravel-feature-usage

Do not use Facades and utilize dependency injection instead. Not every application has them enabled.


class EchoBroadcaster implements Broadcaster
{
Expand All @@ -24,17 +25,15 @@

public function authorized(Request $request): JsonResponse
{
$userId = md5(
$request->input('channel_name')
. $request->input('socket_id'),
$pusher = Broadcast::getPusher();

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.3 with Laravel ^11 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.3 with Laravel ^10 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.2 with Laravel ^11 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.0 with Laravel ^9 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.1 with Laravel ^10 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.2 with Laravel ^11 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.3 with Laravel ^9 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.2 with Laravel ^10 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.1 with Laravel ^9 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.2 with Laravel ^9 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.3 with Laravel ^10 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.3 with Laravel ^9 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.3 with Laravel ^11 and highest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.0 with Laravel ^9 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.1 with Laravel ^10 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.2 with Laravel ^9 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.1 with Laravel ^9 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().

Check failure on line 28 in src/Subscriptions/Broadcasters/EchoBroadcaster.php

View workflow job for this annotation

GitHub Actions / PHPStan on PHP 8.2 with Laravel ^10 and lowest dependencies

Call to an undefined static method Illuminate\Support\Facades\Broadcast::getPusher().
$channel = $request->input('channel_name');
$socketId = $request->input('socket_id');
$data = \Safe\json_decode(
$pusher->socket_auth($channel, $socketId),
true,
);

return new JsonResponse([
'channel_data' => [
'user_id' => $userId,
'user_info' => [],
],
], 200);
return new JsonResponse($data, 200);
}

public function unauthorized(Request $request): JsonResponse
Expand Down
Loading