So you’re ready to connect your device to eagle.io over TCP/IP but how do you decide which transport is most appropriate for your application?
The TCP Client transport requires your device to have an internet connection with a public internet address and is the simplest method to configure.
Typically, your fixed-line internet service will include a public address, though you may need to use port forwarding to connect to your device. Most cellular data services (such as your smartphone or wireless modem) do not include a public address, though carriers in the USA generally still provide this as an option.
If you choose TCP Client transport, eagle.io will initiate the connection to your device at the schedule you define on the Collection tab of your Data Source properties.
The TCP Callback transport requires your device to have an internet connection but it does not need a public address.
If you choose TCP Callback transport, your device must initiate the connection to device.eagle.io:4332 at the schedule defined by your device.
Because the connection is initiated by your device, the device must identify itself to eagle.io before data can be transferred. For this purpose, we generate a unique Device ID that must be sent by your device (followed by a carriage return) at the start of each TCP session.
Once the connection is initialised, the device should keep the TCP session open and eagle.io will immediately begin acquiring data. Your device can trigger data collection at any time simply by reconnecting the TCP session.
One disadvantage of this approach is that each device in your network will require unique configuration. The upside is your device has more control over when data collection is performed.
TCP Callback transport will work in more scenarios but will require a programmable device that can initiate a TCP connection.
So which transport should I use?
Use TCP Client if your device can obtain a public internet address, otherwise thank your lucky stars eagle.io invented TCP Callback :)