Thursday 20 December 2018

point me in the right direction for some node technologies

Greetings all.I am coming from a rails platform with a simple API that I am moving to node.jsI have an app built in React-Native with Expo. So here is my issue.I use Mobix to handle state on the app. I like it a lot. Actually, the whole idea of state changes updating the view instead of page refreshes is just awesome to me. However, our company allows our clients to control industrial machines with our app. Right now, to get the change of state of the machine, I am making lots of calls to the API for updates from our server. For example, if a customer presses "start" on the app, it takes a minute or two before the machine is running and our database knows about it. I don't want the app repeatedly making calls to the server to check if its running or not. Push notifications seem to be an idea but also seem a bit overkill. I have looked at Socket.io, but am not sure if it was really meant for a task like this, to push information to the App. So this is one area I am looking for an answer to.The other thing is our data processing. When a machine reports to our system its state (running, off, idle, etc..) we do a lot of processing on it's sensors (pressure, current, etc) to properly know the status of the machine. We log it's history, running time, etc.. I am starting to write more of this process in node.js and would like to share some code between the webserver code and the engine code because a lot of it is similar. Would a framework be better suited to something like this? (currently using Objection.js as my data interface and Express as the api server) . I mean, a lot of things the app needs to know are the same things the machine processes need to know. But our machine process sending requests to our api server would (because of http) be quite overkill and i wonder if it would even be fast enough to keep up.I am reading lots of articles about data mappers and socket servers and was thinking perhaps an idea might be to have functions in the API that pull (via tcp) info from our machine processes code that make use of some of the same data mapping before sending that result via JSON to the client. Or is it a better discipline to keep these separate for the sake of maintainability?So, I guess my questions are about technologies I may not know exists, or best practice kind of questions. Sorry for the long post, any ideas would be very helpful and well considered.

Submitted December 20, 2018 at 05:19PM by s-keL

No comments:

Post a Comment