Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5pt,9pt] HTTP block #236

Closed
RalphSteinhagen opened this issue Dec 20, 2023 · 0 comments · Fixed by #262
Closed

[5pt,9pt] HTTP block #236

RalphSteinhagen opened this issue Dec 20, 2023 · 0 comments · Fixed by #262
Assignees

Comments

@RalphSteinhagen
Copy link
Member

RalphSteinhagen commented Dec 20, 2023

Implement a GR 4.0 Block, that can provide its values over a HTTP REST API.

For network calls, the native client will use httplib, the emscripten build will use emscripten’s own Fetch API.

The idea is that the Block will post a GET request to some server, which will then return a response (in the first stage, only raw messages and mime-type export are implemented (i.e. mime-type application/octet-stream, later on text/yaml and other serialized formats can follow). The Block implementation will then provide the decoded values on its output port(s). For the raw message mime-type, this means one output port OutPort<pmt> with keys mime-type and raw-data.

There are a few different ways how to tell the Block when to do a GET request. For example, one idea is to send a GET request every time activity happens on an input port (for now, use InPort<uint8_t>). If the Block is supposed to act in an interrupt-style way, long-polling can be used. An input port can be used to signal to the Block whether the subscription should be kept active. The long-polling should work like the already existing OpenCMW schema and should have transparent caching proxy capabilities so that clients subscribing to the same feed can be served efficiently.

The URI of the remote server should be changeable at runtime. This requires implementing the settings_changed(...), start() and stop() methods.

Since HTTP calls may be unreliable (the server may stop responding altogether), a circuit breaker pattern could be used to avoid flooding the server with too many calls in such a scenario and to automatically start allowing calls after some time when the server is up again.

@RalphSteinhagen RalphSteinhagen converted this from a draft issue Dec 20, 2023
@vimpostor vimpostor moved this from 🔖 Selected (3) to 🏗 In progress in Digitizer Reimplementation Dec 21, 2023
vimpostor added a commit that referenced this issue Feb 5, 2024
In the future we might want to consider using the message port mechanism
to trigger the requests.

Fixes #236
@vimpostor vimpostor linked a pull request Feb 5, 2024 that will close this issue
vimpostor added a commit that referenced this issue Feb 6, 2024
In the future we might want to consider using the message port mechanism
to trigger the requests.

Fixes #236
@vimpostor vimpostor moved this from 🏗 In progress to Finished Implementation (2) in Digitizer Reimplementation Feb 6, 2024
@vimpostor vimpostor changed the title [5pt] HTTP block [5pt,9pt] HTTP block Feb 6, 2024
vimpostor added a commit that referenced this issue Feb 15, 2024
In the future we might want to consider using the message port mechanism
to trigger the requests.

Fixes #236
vimpostor added a commit that referenced this issue Feb 15, 2024
This block can use both message ports as well as a public member
function as a trigger to make requests to a HTTP API (e.g. REST API) and
will return the response on its output ports.

Fixes #236
vimpostor added a commit that referenced this issue Feb 15, 2024
This block can use both message ports as well as a public member
function as a trigger to make requests to a HTTP API (e.g. REST API) and
will return the response on its output ports.

Fixes #236
vimpostor added a commit that referenced this issue Feb 15, 2024
This block can use both message ports as well as a public member
function as a trigger to make requests to a HTTP API (e.g. REST API) and
will return the response on its output ports.

Fixes #236
@RalphSteinhagen RalphSteinhagen moved this from Finished Implementation (2) to ✅ QA-Accepted/Merged (∞) in Digitizer Reimplementation Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: QA-Accepted/Merged (∞)
Development

Successfully merging a pull request may close this issue.

2 participants