tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.65k stars 511 forks source link

Is there ways to emit data from client (socket.io-client) to laravel-echo-server? #598

Closed Thihasoehlaing closed 1 year ago

Thihasoehlaing commented 1 year ago

Guys, I'm using laravel-echo-server and socket.io-client. I'm having a problem that is to emit from client. I search any possibility but still not found. I found Echo.connector.socket.emit('EVENT_NAME', 'CHANNEL', { /* DATA OBJECT */ }); but when I console.log , there is no emit and how to listen from server? any help pls.

noumanhabib commented 1 year ago

It is dificult (may be impossible) to emit event to server. The answer is simple you have to use API calls from front-end to laravel backend. Then from laravel backend emit events as you are doing before.

Thihasoehlaing commented 1 year ago

It is dificult (may be impossible) to emit event to server.

The answer is simple you have to use API calls from front-end to laravel backend. Then from laravel backend emit events as you are doing before.

Thanks for reply, I tried everything. Now using api calls