ihxnnxs's avatar

livewire not updating chat when sending messages

Hello everyone. My stack is laravel 12, reverb, livewire. The problem is that my chat does not update when sending messages. I see through DevTools that messages are coming and everything works on the backend level. It seems to me that Livewire just does not respond to websocket messages

Code:

AdminChat.php:

admin-chat.blade.php:

MessageSent.php:

channels.php:

<?php

use Illuminate\Support\Facades\Broadcast;

Broadcast::channel('chat.{project_id}', function ($user, $project_id) {
    return auth()->user()->status === 'admin' || $project_id->user_id === auth()->id();
});

app.js:

import './bootstrap';
import Alpine from 'alpinejs'
import focus from '@alpinejs/focus'

window.Alpine = Alpine

Alpine.plugin(focus)

Alpine.start()

If you need any other file, then let me know and I will gladly provide it. Thanks in advance❤️

0 likes
0 replies

Please or to participate in this conversation.