laravel-websockets-demo
laravel-websockets-demo copied to clipboard
Sending client message through Websocket
It appears to me that the messages are not sent over the websocket, but using a regular POST request. I base this on the following code in resources/js/app.js
:
axios.post('/messages', message).then(response => {
console.log(response.data);
})
Am I wrong? The functionality I'm looking for is sending data from client to server over a websocket. Any help is appreciated :)
Yes by this way message are not send by websockets. if you are using Laravel Echo then i,m afraid its not possible to trigger event through laravel echo. you can trigger event using redis, pub/sub .
It appears to me that the messages are not sent over the websocket, but using a regular POST request. I base this on the following code in
resources/js/app.js
:
Hello @sjorspeterse , did you implement to send messages via websocket?