8000 Drop pusher/pusher-php-server 4.x (#36528) · laravel/framework@e16f4b6 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit e16f4b6

Browse files
Drop pusher/pusher-php-server 4.x (#36528)
Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent 1762bd9 commit e16f4b6

File tree

3 files changed

+9
-36
lines changed

3 files changed

+9
-36
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"phpunit/phpunit": "Required to use assertions and run tests (^9.4).",
147147
"predis/predis": "Required to use the predis connector (^1.1.2).",
148148
"psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).",
149-
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0|^5.0).",
149+
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0).",
150150
"symfony/cache": "Required to PSR-6 cache bridge (^5.3).",
151151
"symfony/filesystem": "Required to enable support for relative symbolic links (^5.3).",
152152
"symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).",

src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -111,46 +111,19 @@ public function broadcast(array $channels, $event, array $payload = [])
111111
{
112112
$socket = Arr::pull($payload, 'socket');
113113

114-
if ($this->pusherServerIsVersionFiveOrGreater()) {
115-
$parameters = $socket !== null ? ['socket_id' => $socket] : [];
116-
117-
try {
118-
$this->pusher->trigger(
119-
$this->formatChannels($channels), $event, $payload, $parameters
120-
);
121-
} catch (ApiErrorException $e) {
122-
throw new BroadcastException(
123-
sprintf('Pusher error: %s.', $e->getMessage())
124-
);
125-
}
126-
} else {
127-
$response = $this->pusher->trigger(
128-
$this->formatChannels($channels), $event, $payload, $socket, true
129-
);
130-
131-
if ((is_array($response) && $response['status'] >= 200 && $response['status'] <= 299)
132-
|| $response === true) {
133-
return;
134-
}
114+
$parameters = $socket !== null ? ['socket_id' => $socket] : [];
135115

116+
try {
117+
$this->pusher->trigger(
118+
$this->formatChannels($channels), $event, $payload, $parameters
119+
);
120+
} catch (ApiErrorException $e) {
136121
throw new BroadcastException(
137-
! empty($response['body'])
138-
? sprintf('Pusher error: %s.', $response['body'])
139-
: 'Failed to connect to Pusher.'
122+
sprintf('Pusher error: %s.', $e->getMessage())
140123
);
141124
}
142125
}
143126

144-
/**
145-
* Determine if the Pusher PHP server is version 5.0 or greater.
146-
*
147-
* @return bool
148-
*/
149-
protected function pusherServerIsVersionFiveOrGreater()
150-
{
151-
return class_exists(ApiErrorException::class);
152-
}
153-
154127
/**
155128
* Get the Pusher SDK instance.
156129
*

src/Illuminate/Broadcasting/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
}
3535
},
3636
"suggest": {
37-
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0|^5.0)."
37+
"pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^5.0)."
3838
},
3939
"config": {
4040
"sort-packages": true

0 commit comments

Comments
 (0)
0