Level 3
[{"type":"WebSocketError","error":{"type":"PusherError","data":{"code":null,"message":"user_info supplied to presence subscription is invalid - if supplied it must be a type of hash"}}}]
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
JS
var presenceChannel = pusher.subscribe('presence-onlineusers.'+user);
presenceChannel.bind('onlineusers', function(data) {
alert(JSON.stringify(presenceChannel));
});
Event showing in pusher but not appearing in my page
Channel
Broadcast::channel('onlineusers.{id}', function () {
return Auth::check();
});
Event
<?php
namespace App\Events;
use App\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class UpdateLiveUser implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $vid;
public function __construct($vid)
{
$this->vid = $vid;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
// return ['onlineusers'];
return new PresenceChannel('onlineusers.'.$vid);
}
public function broadcastAs()
{
return 'onlineusers';
}
public function broadcastWith()
{
return [
// 'body' => $this->vmsg,
// 'title' => $this->vname,
// 'name' => $this->vtitle,
// 'avatar' => $this->vimg,
// 'type' => $this->vtype,
'rid' => \Auth::id()
];
}
}
Trigger as
event(new \App\Events\UpdateLiveUser($vid));
Please or to participate in this conversation.