henrichg / PhoneProfilesPlus

Profile manager for Android - event triggered
Apache License 2.0
408 stars 32 forks source link

[Feature request] HTTP Event sensor #85

Open balporig opened 2 years ago

balporig commented 2 years ago

An HTTP sensor that can make a GET/POST requests in a scheduled manner that is triggered when the response body contains a specific string (will require parsing the body with regex/ simple search) or on a given response code. The scheduling can be done with the Time sensor. Example input parameters:

Triggers

Usecase

henrichg commented 2 years ago

Hm, hm, I will looking on it. But this must be broadcast (UDP?). Yes? I must studying how internet connectivity working. :-)

balporig commented 2 years ago

HTTP/1.1 and HTTP/2 use TCP, HTTP/3 uses UDP. In general, unless you implement the actual connection, you shouldn't care. Almost all languages include rest clients in the standard libraries. I have not written Java in a long time, but a quick search brings HttpURLConnection  |  Android Developers or Overview - OkHttp. The latter looks more useful. Here's an example client similar to what we're trying to achieve here: Waboodoo/HTTP-Shortcuts: Android app to create home screen shortcuts that trigger arbitrary HTTP requests