Reputation: 217
I wrote the backend with Laravel as an api and the front with vueJs, of course, are completely separate.
Now I want to create notifications for some tasks.
I do not want to use the pusher and I want to create the socket myself (to practice and understand how it works). Now my question is, do I have to create a separate socket for both Back and Front and connect both of them to the same port?
Thankful.
Upvotes: 0
Views: 364
Reputation: 703
you can use the laravel-echo
on the client-side and use the laravel-echo-server
on the server-side.
at the first, you should install and configure the laravel-echo-serve
then run it in your server.
now for client-side, install the laravel-echo and listen to your custom port which you defined in laravel-echo-serve
config.
And for call your socket, just enough create an event in your laravel project and create an instance like below and place it in your desired location:
event(new App/Events/ExampleEvent());
Upvotes: 1