Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 26, 2018
1 parent 673e085 commit b9ab427
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/Illuminate/Broadcasting/BroadcastManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public function routes(array $attributes = null)
$attributes = $attributes ?: ['middleware' => ['web']];

$this->app['router']->group($attributes, function ($router) {
$router->match(['post', 'get'], '/broadcasting/auth',
$router->match(
['get', 'post'], '/broadcasting/auth',
'\\'.BroadcastController::class.'@authenticate'
);
});
Expand Down
19 changes: 10 additions & 9 deletions src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,34 @@ public function validAuthenticationResponse($request, $result)
{
if (Str::startsWith($request->channel_name, 'private')) {
return $this->decodePusherResponse(
$request,
$this->pusher->socket_auth($request->channel_name, $request->socket_id)
$request, $this->pusher->socket_auth($request->channel_name, $request->socket_id)
);
}

return $this->decodePusherResponse(
$request,
$this->pusher->presence_auth(
$request->channel_name, $request->socket_id, $request->user()->getAuthIdentifier(), $result)
$request->channel_name, $request->socket_id,
$request->user()->getAuthIdentifier(), $result
)
);
}

/**
* Decode the given Pusher response, apply the callback for JSONP support.
* Decode the given Pusher response.
*
* @param mixed $request
* @param \Illuminate\Http\Request $request
* @param mixed $response
* @return array
*/
protected function decodePusherResponse($request, $response)
{
if ($request->callback) {
return response()->json(json_decode($response, true))
->withCallback($request->callback);
if (! $request->callback) {
return json_decode($response, true);
}

return json_decode($response, true);
return response()->json(json_decode($response, true))
->withCallback($request->callback);
}

/**
Expand Down

0 comments on commit b9ab427

Please sign in to comment.