0

I'm trying to react to connecting with laravel-websockets. There are custom handlers
https://beyondco.de/docs/laravel-websockets/advanced-usage/custom-websocket-handlers

And there are endpoint

WebSocketsRouter::webSocket('/my-websocket', \App\MyCustomWebSocketHandler::class);

I don't understand, what I need to do to invoke this reaction? Do I need to make new connection, using

Echo.join('my-websocket');

? Or I can join to any channel, and this events will be triggered?

Lamantinoss
  • 159
  • 1
  • 8

1 Answers1

0

Actually You cann't use Echo as front end library to connect to your websocket server just use regular websocket api ex:

const socket = new Websocket(urlToWebsocket) //ws://127.0.0.1:6001/my-websocket

sockt.onopen = ()=>{

}

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Eyad Mohammed Osama Apr 04 '23 at 11:44