Re: Reverse connection without port forwarding?
Posted: Tue Aug 07, 2018 7:47 am
For my application a ten minute poll rate from the device would be acceptable. After that there would need to be a persistent connection if in use.
-->
Open Community Forum for ESP8266, Come share Arduino and IoT (Internet of Things)
https://www.esp8266.com/
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.
Like
Maximum number of devices
The traffic required; volume of data and maximum latency time that can be tolerated.
Security requirements
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.