Hi
My application backend is on laravel (separate directory ) and front end is on react js, deployed on separate directory but same server
I have some apis for chat messages, whenever a user sends message, my laravel backend broadcasts event using laravel websockets
https://github.com/beyondcode/laravel-websockets
I want to listen these event on my frontend app on a specific port , please guide how can i listen these events using laravel echo or websocket.
Note: my laravel websocket server currently running on port 6001
my react app is on port 3000
while backend server is on port 8000
I have configured the server , for websockets its working properly , but i am unable to listen for events triggered by server on a separate react application
yes both are on same domain but in different directories , whenever the connection is successful with backend I get success message also, and channel is also subscribed (i am tracking in laravel websockets debugger panel),
I fixed it by changing channel name in listenere
for example you have event NEW_MESSAGE broadcasting from laravel
then in your client side insted of listening to NEW_MESSAGE event listen for ".NEW_MESSAGE" or add dot before event
ECHO.listen("NEW_MESSAGE")
to
ECHO.listen(".NEW_MESSAGE")
@sarmadindhar Thank you for your reply, it is working now .. but not in all browsers, it worked for me perfectly in Edge browser, but not in chrome and brave I keep getting this error "runtime.lasterror the message port closed before a response was received" any idea why ?