10

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?

Helmar
  • 8,450
  • 6
  • 36
  • 84

1 Answers1

7

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.

mico
  • 4,351
  • 1
  • 18
  • 27