Ajax, Vuejs, Laravel, Events...without redis.
I'm having a hard time conceptualizing how do go about accomplishing something...so I need help!
I want to make an event trigger when I receive a certain post request to force an update to the DOM from JSON information from my database (like a pushed API call) but distribute it dynamically to the appropriate div.
So let's say I receive a POST request from another server at a specific route, it triggers a controller to write something into my database (which is done and works like a champ), then it triggers an event to send the JSON:
{ name: "car-2", model: "acura-1", value: "10" }
...to a VUEJS instance...
method: function updateDOM(data) {
// receive info from server when sent
// force update of ONLY the respective DIVs with the changed information
}
that sends it along and somehow finds the "car" div ID, looks for a sub-class of "acura" and replaces or places the value "10" into like that.
<div id="acura-1">
<div class="car-1"></div>
<div class="car-2">10</div>
</div>
I really feel like this is the kind of stuff Vue is MADE for but...I don't quite know how to go about accomplishing sending information from the server to the DOM without an event REQUESTING IT from the server...
My current javascript server is just using setInterval(getValues, 5000); but I want to get AWAY from that type of design...
The reason I'm not using websockets for this is because websockets have browser limitations (256 on most browsers) and also sometimes close without re-initializing -- basically not reliable enough with the number of connections I need open concurrently. Also, I'm not counting on the user reloading the page (used in corporate displays), so it has to be rather reliable.
I have watched all of the Redis, socket.io, Wonderful World of Vue, and the newest Vue series...
Anyways, thanks for your attention!
Please or to participate in this conversation.