Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

dev.khosromanesh's avatar

issue with channel | channel not send the any response

hello guys with

we have a websocket project which using pusher service . pusher configured right.

an event class created in following code:

class Message implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;
    public $message;
    public function __construct($message)
    {
        $this->message = $message;
    }
    
    public function broadcastOn()
    {
        return new Channel('chat');
    }
    
    public function broadcastAs(){
        return 'message';
    }
}

web.php code:

Route::post('/send-message',function (Request $request){
    event(new Message($request->input('message')));
    return ["success" => true];
});

use axios for send post request . the request response with 200 status code

also in app.js file we have :

import './bootstrap';

let message_input = document.getElementById('message')
let message_submit = document.getElementById('message_sent')

message_submit.addEventListener('click', function (e){
    e.preventDefault()


    const options = {
        method: 'post',
        url: '/send-message',
        data:{
            message: message_input.value
        }
    }
    axios(options)
})




window.Echo.channel('chat').listen('message',(e)=>{
    console.log(e)
})

problem is nothing show in console area someone help me please

0 likes
0 replies

Please or to participate in this conversation.