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

Allow apps to handle external HTTP requests #714

Open
lo5 opened this issue Mar 29, 2021 · 0 comments
Open

Allow apps to handle external HTTP requests #714

lo5 opened this issue Mar 29, 2021 · 0 comments
Labels
feature Feature request server Related to server

Comments

@lo5
Copy link
Member

lo5 commented Mar 29, 2021

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 #500

Via @themutt on Discourse:

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:

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

@lo5 lo5 added server Related to server feature Feature request labels Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request server Related to server
Projects
None yet
Development

No branches or pull requests

1 participant