Skip to content

Commit

Permalink
Added checks for new 7.1 functions (#42632)
Browse files Browse the repository at this point in the history
  • Loading branch information
rennokki authored Jun 3, 2022
1 parent 6226955 commit 7280609
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public function resolveAuthenticatedUser($request)
return;
}

if (method_exists($this->pusher, 'authenticateUser')) {
return $this->pusher->authenticateUser($request->socket_id, $user);
}

$settings = $this->pusher->getSettings();
$encodedUser = json_encode($user);
$decodedString = "{$request->socket_id}::user::{$encodedUser}";
Expand Down Expand Up @@ -94,7 +98,10 @@ public function validAuthenticationResponse($request, $result)
{
if (str_starts_with($request->channel_name, 'private')) {
return $this->decodePusherResponse(
$request, $this->pusher->socket_auth($request->channel_name, $request->socket_id)
$request,
method_exists($this->pusher, 'authorizeChannel')
? $this->pusher->authorizeChannel($request->channel_name, $request->socket_id)
: $this->pusher->socket_auth($request->channel_name, $request->socket_id)
);
}

Expand All @@ -108,10 +115,9 @@ public function validAuthenticationResponse($request, $result)

return $this->decodePusherResponse(
$request,
$this->pusher->presence_auth(
$request->channel_name, $request->socket_id,
$broadcastIdentifier, $result
)
method_exists($this->pusher, 'authorizePresenceChannel')
? $this->pusher->authorizePresenceChannel($request->channel_name, $request->socket_id, $broadcastIdentifier, $result)
: $this->pusher->presence_auth($request->channel_name, $request->socket_id, $broadcastIdentifier, $result)
);
}

Expand Down

0 comments on commit 7280609

Please sign in to comment.