h2oai / h2oai/wave

Allow apps to handle external HTTP requests

Open
#714 0 comments 2 reactions 0 assignees View on GitHub
feature server
Dominant language
Python
Stars
4.3k
Forks
371
Avg merge
26d 1h
Merged PRs (30d)
1

Description

Implement ability for an external tool (like cURL) to impersonate a user and make a POST request to the waved web server, and have that request be passed on to the app as-is, so that it can update the UI. Related to https://github.com/h2oai/wave/issues/500

Via @themutt on [Discourse](https://h2owave.h2o.ai/t/handling-external-request/97):

> I don’t know if this is out of the scope of wave but is it possible to send requests from an external service to a wave app and have the wave app handling it correctly? For example, consider the following snippet:

```py
from h2o_wave import site, ui, Q, main, app, on, handle_on

@app('/demo', mode='broadcast')
async def serve(q: Q):
q.page['main'] = ui.markdown_card(
box='1 1 -1 -1', title='Demo', content=f'Main page: [Make a request](#request)')
if q.args['#'] == 'request':
q.page['main'].content = 'Got request'
await q.page.save()
Would it be possible from cURL for example to send a POST request to https://.../demo#request?
```

> I can give you my specific use case as an example: I have an external web app (grafana) that is sending me POST requests whenever I receive an alert on a value. I would like that POST request to go through the wave app to perform a simple calculation and update the UI of the wave app.

> In general it could be interesting to have the possibility for a wave app to accept requests from external entities to allow inter-operation between services

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.