Reputation: 399
so I have my NodeJS-App, which recieves Data via Serial and also provides a little http-server to display some HTML.
Now I need to manipulate the outputted DOM in real-time, depending on the Data NodeJS recieves. What would be the best practise for that? Should I use Websockets for communication between NodeJS and the DOM? Or am I completely wrong?
Upvotes: 0
Views: 730
Reputation: 189
I am currently doing something similar. I am currently using jquery ajax GET and POST requests to handle it. while webrequests would work, its not realtime and does not update other clients if one client changes something. For realtime i would research into intergrating socket.io as it is realtime. the exact method of doing so would vary based on your specifications and your current setup. for instance if you are using express.js to handle the requests, it would be easier to intergrate than say native node.js. if speed and wait time is a factor, look into react.js to speed up the update process on the client side without reloading the page.
Upvotes: 1