this is a theoretical question.
What's usually the flow/structure used to send command from an app to a specific sensor using TCP/IP sockets?
I'm trying to build a tracker <> app system, I can receive information from the tracker and display on the app, however what's not totally clear to me is the communication on the other way around (app -> tracker) e.g. requesting a single position. For that I was thinking on the following structure:
- Set up a AWS API GATEWAY to listen for an upcoming POST request. That post request will be performed when I click the button on my app and I need to provide the device's ip address.
- Then, set up AWS API GATEWAY to trigger the lambda which will handle the request, instantiate the socket with the correct address and send the command to the specific client.
Is that correct?
EXTRA
Two other statement that I would like to check if it's correct:
That sensor will probably have a socket connection attached to my server (since it will be communicating with the server) but there's no problem because the socket created on lambda when sending a command to the device will open another port (the next available) and send the command normally.
I thought also in trying to reach out the server (which is running on an EC2) from the lambda, since it has the socket connected to the device, but I think that's way more work to do (than the other approach explained before) and it's not necessary.