We have an application where an Edge Device (Server) will stream data after an initial GET HTTP request, but we are not sure how to implement the Python Scripts to handle the streaming response. Does anyone have any experience with this type of HTTP request? Many thanks in advance to the forum.
I would expect this to be possible with system.net.httpClient
. If it doesn't work directly "out of the box", there's an escape hatch attribute; system.net.httpClient().javaClient
will return the underlying java.net.http.HttpClient
instance, which you can call any of the Java methods on directly.
I did this for a few applications in a few different ways. You can use the example from the exchange is this weather api Ignition Exchange | Inductive Automation to collect data via and API and do something with it ie parse it into tags. This is not documented but it is easy enough to dig through.
Alternatively, you can use thewebplebs method https://www.youtube.com/watch?v=76yyws1odKA to send data somewhere.
At the end of the day, you will need to understand your stream first. JSON is easy to parse. Once you know what your stream looks like, you can parse the data out at a particular poll rate.
There are also some Ignition/Redis and Ignition/Kafka modules that are publically available in Git Hub. Should you want to go that route, you will be on your own there.
Thanks guys. I will look into these options and see where I land.