laravel-websockets-demo icon indicating copy to clipboard operation
laravel-websockets-demo copied to clipboard

Sending client message through Websocket

Open sjorspeterse opened this issue 4 years ago • 1 comments

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 :)

sjorspeterse avatar Oct 04 '20 09:10 sjorspeterse

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 .

techcodex avatar Dec 25 '20 21:12 techcodex

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?

Pavel-Mukha avatar Nov 01 '22 10:11 Pavel-Mukha