0

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.

1
  • Laravel framework includes a submodule called Illuminate\Broadcasting to implement WebSockets for real-time, live-updating user interfaces. They provide different socket connections using pusher and redis and so on. I recommend you to read this link; laravel.com/docs/8.x/broadcasting Commented Oct 30, 2020 at 8:13

1 Answer 1

1

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());
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.