I need to use different Pusher account for a specific part of my web app, so I tried to override the config using the following:
public function send(Request $request)
{
$general_pusher = config('broadcasting.connections.pusher');
$message = Message::create([
'from' => auth()->id(),
'to' => $request->contact_id,
'text' => $request->text
]);
\Config::set('broadcasting.connections.pusher', config('cfg.internal_chat_pusher'));
logger(config('broadcasting.connections.pusher'));
broadcast(new NewMessage($message));
\Config::set('broadcasting.connections.pusher', config('cfg.internal_chat_pusher'));
return response()->json($message);
}
then, I tried to test using a random value for which Laravel should raise an error, but no error and the messages get sent and received, but using the original/old pusher config values.
as you can see I used the logger
instruction which give me the following:
[2020-09-19 14:06:09] local.DEBUG: array (
'driver' => 'pusher',
'key' => '1',
'secret' => '1',
'app_id' => '1',
'options' =>
array (
'cluster' => '1',
'useTLS' => true,
),
)
but, even though the logger
command output the values that should give the error, I get no error, and messages get sent and received perfectly.
how to use different pusher account for a specific event?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/35PuRJa
via IFTTT
Aucun commentaire:
Enregistrer un commentaire