btidey wrote:lucasromeiro wrote:btidey wrote:The role reversal is a useful concept, but it still requires the device behind the NAT to initiate the transaction. In this case the beacon is making periodic connection attempts (polling).
The OP seemed to be seeking a solution where the external device directly addresses the internal device without any delay or action on the internal devices part and without setting something up specifically on the NAT router. Once it is realised that this is not achievable then a number of other methods can probably be used to actually deliver a feasible solution.
What solutions do you suggest?
I'm studying to find out the best way.
Like in most things there is no 'best way'. It depends on what you are trying to achieve.
The first thing to do is to write down the characteristics of what you are trying to achieve.
Maximum number of devices
The traffic required; volume of data and maximum latency time that can be tolerated.
You also need to set out potential resources; speed and maximum delays of the network connections, and what can be deployed for the server.
The two basic techniques are going to be polling from the device or maintaining persistent connections. Polling has simplicity and the volume can be traded off against latency. Persistent connections will give the fastest response but requires extra server side resources to handle multiple connections. Note that device side logic can be put in place to restore connections when network drops occur.
Either method can require significant server side resource as the number of devices scales up so this can mean using either a decent locally hosted server or using a cloud server method if extra scaling is required.
A decent server should be able to maintain several thousand connections depending on the volume of traffic.
One could also look at some commercial cloud solutions that can give this type of IoT hosting support if that was appropriate. For example, Amazon IoT AWS services which can be easily accessed via Mongoose OS. Underneath tey are still using the same basic methods but hide the details and give scaleability.
Exactly my problem!
Today we have few remotes in the field, but we are forecasting a big increase. Imagine thousands of remotest people around the world. We need to do something that is reliable to be able to send reverse commands.
The biggest problem in our case is that our automation product gets a command from our website and should run as fast as possible.
For example, if I install our product to open a port, the client will listen to the phone, open the application and send the command, but if this command takes too long, the product looks bad.
Then our commands need to be executed as quickly as possible.
Is a 10-second pooling a lot?
Probably yes, when I have thousands of remote in the field, connecting every 10 seconds.
But one thing got my attention, when you spoke of "Amazon IoT AWS services". It may be a great solution, outsource this pooling load on another, more robust server.
Do you know other servers of the genre? I'm researching prices.
I can not see any other solution ....