Answer the question
In order to leave comments, you need to log in
What is the best way to update data?
Hello! Tell me , please:
- There is an admin panel (for example, on Yii2), simple crud news functions.
- There is a front part on Vue that gets a list of these news and outputs them.
I want to make it so that when adding, deleting, editing news in the admin panel on Vue, the data is automatically updated.
To do this, you need to use node and web sockets.
Here the question is, how to properly connect PHP node and Vue?
Answer the question
In order to leave comments, you need to log in
Yes, it’s very easy to do this .. Run the service on a node with a ready-made or for sockets (socket.io, for example), connect the front to it. You start the queue service, the same radish is suitable for this task. When an article is updated on the server, you send it to the node through radish. There actually send to all clients.
And do not listen to what they wrote to you here, this is quite a common task and it works instantly. You can google about how message queues work, in short, this is a channel that will listen to your service on the node and take messages from there that will come from PHP.
In Laravel, by the way, such a system is available out of the box, but on yii I found this, you can also test https://github.com/MKiselev/yii2-broadcasting/blob...
How often will the data be updated?
It is likely that you will have enough ajax request on a timer to get an updated list of news.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question