neoighodaro / laravel-pusher-web-notifications

An example on how to use Laravel and Pusher to create a web notification system.
87 stars 128 forks source link

array_merge(): Argument #2 is not an array in Pusher.php #10

Closed lautaro-corfield closed 3 years ago

lautaro-corfield commented 3 years ago

Hi ! How are you ? I post my code. .env file PUSHER_APP_ID=## BROADCAST_DRIVER=pusher PUSHER_APP_ID=### PUSHER_APP_KEY=## PUSHER_APP_SECRET=

Event file `class MessageToProveedor implements ShouldBroadcast{ use Dispatchable, InteractsWithSockets, SerializesModels; public $username; public $message;

public function __construct($username)
{
    $this->username = $username;
    $this->message  = "liked your status";
}

/**
 * Get the channels the event should broadcast on.
 *
 * @return \Illuminate\Broadcasting\Channel|array
 */
public function broadcastOn()
{
    //channel
    return ['my-channel'];
}
public function broadcastAs()
{
    //event
    return 'my-event';
}

}`

JS File `

` **web.php (route) send message** `Route::get('push', function () { event(new App\Events\MessageToProveedor("ssa")); return "Event has been sent!"; })->name('push');` The error is on title. I don´t find any solution. **My log console:** `Pusher : State changed : connecting -> connected with new socket ID ## pusher.min.js:8 Pusher : Event sent : {"event":"pusher:subscribe","data":{"channel":"my-channel"}} pusher.min.js:8 Pusher : Event recd : {"event":"pusher_internal:subscription_succeeded","data":{},"channel":"my-channel"} pusher.min.js:8 Pusher : No callbacks on my-channel for pusher:subscription_succeeded`
lautaro-corfield commented 3 years ago

Solution: https://stackoverflow.com/questions/66478141/php-error-with-array-merge-in-pusher-second-param-is-null/66478528?noredirect=1#comment117524247_66478528