munafio / chatify

Laravel's #1 one-to-one chatting system package, helps you add a complete real-time chatting system to your new/existing Laravel application with only one command.

Home Page:https://chatify.munafio.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Depreciated socket_auth() for pusher authentication

solomiles opened this issue · comments

Hi munafio, great package you created here. i was going through the source code and discovered this.. its not really a big deal actually but pusher has depreciated this method "socket_auth()" in favour of "authorizeChannel()" A big Thanks for this package once again
/**
* Authentication for pusher
*
* @param User $requestUser
* @param User $authUser
* @param string $channelName
* @param string $socket_id
* @param array $data
* @return void
*/
public function pusherAuth($requestUser, $authUser, $channelName, $socket_id)
{
// Auth data
$authData = json_encode([
'user_id' => $authUser->id,
'user_info' => [
'name' => $authUser->name
]
]);
// check if user authenticated
if (Auth::check()) {
if($requestUser->id == $authUser->id){
return $this->pusher->socket_auth(
$channelName,
$socket_id,
$authData
);
}
// if not authorized
return response()->json(['message'=>'Unauthorized'], 401);
}
// if not authenticated
return response()->json(['message'=>'Not authenticated'], 403);
}

@solomiles That's right, already trying to use the new method but it leads to issues that's why I kept it this way since it won't affect anything