Right now I'm working on architecture for application that will manage smart sockets and I need advice. This is what I have for now:

system architecture

I'm not sure how to handle connection between Spring and smart socket (I want to be able to turn on/off socket from my web app). I communicate with my sockets via HTTP. My idea is to have server that will manage connections and commands between Spring and sockets:

  1. When socket will be turned on, it will try to connect to the server.
  2. Server will wait for new connections from smart sockets, to save them. Also it will wait for commands from Spring to change state of the socket.

Is it a good idea? If yes, is there any tool that will help me do that (maybe build in in Spring), or should I write it on my own?

  • At first glance there is a lot of moving parts here. At the moment Node-RED doesn't seam to be doing anything except froward data to the Mongo instance, but (assuming this is just for you) it is probably capable of presenting all the front end piece as well – hardillb Oct 4 '17 at 12:38
up vote 7 down vote accepted

You have already capability to publish data over MQTT protocol, even a broker and way to forward certain requests to Spring from the socket.

I see no point of taking the responsibility of knowing whether socket is plugged for some requests for Spring. MQTT broker does that under the hood, you don't have to invent the wheel again.

So, I would create some more publishers and subscriptions to Spring and socket and use MQTT as the protocol there, not touching to http this time at all.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.