A library has been developed to send JSON http messages. See http://store.codesys.com/json-http-client-library.html
With this library it is relatively easy to post data from CODESYS controllers to (web-)servers.
It is very well suited for IoT applications.
It has the following advantages over other solutions:
– The server application doesn’t need to have a specific protocol implementation. HTTP messages with JSON content are already standard in (Internet) communication.
– It is firewall friendly, because the PLC will connect to the server through (default) port 80. Like normal PC’s in a network, this is a standard way to access the internet.
– No continuous polling of data is necessary. Data is only send when specified, e.g. on (timed) trigger, or (alarm) event. This saves programming effort and networkbandwidth, which also saves costs in mobile network communication.
– Various data types can be used, like single variables, arrays and structures. These can be appended to create one single JSON data message.